Need python code for knowing liquidity

Sayantan_Das
I am doing algo trade in python. Please provide me the python code to know liquidity at least top 5 bid and ask price so that I can avoid illiquid options while placing orders. Today 6th June, I got trapped by Nifty 6th June expiry 23150CE and 23350CE which my algo bought and through the whole day there were no sellers. For this I got huge loss. I tried searching such code but could not make sense of any. Please please provide me the specific code please. Huge thanks in advance!
Tagged:
  • Sayantan_Das
    Sayantan_Das edited June 6
    No worries, I have figured it out:

    depth = kite.quote(optionsymbol)[optionsymbol]['depth']

    Please mark this as resolved.
This discussion has been closed.