How to retrieve NIFTY/NIFTYBANK option chain in python using Fyers API

How to retrieve NIFTY/NIFTYBANK option chain in python using Fyers API

Hi @murthy_kadam ,

To retrieve data for Nifty,Niftybank option chain or any symbol you just need to send symbol name to get data.

example -

print(fyers.quotes({"symbols":"NSE:BANKNIFTY2360135700CE"}))

the OI and COI data is not available using “fyers.quote”.

Any other way to retrieve ?

#you can use fyers.depth
data={
      "symbol":"NSE:NIFTY23MAY18150CE",
      "ohlcv_flag":"1"
}
print(fyers.depth(data=data))

What am I missing ?

I do not see the OI .

2023-05-17 11:46:03,523:DEBUG:https://api-t1.fyers.in:443 “GET /data/depth?symbol=NSE%3ANIFTY23MAY18200PE&ohlcv_flag=1 HTTP/1.1” 200 733

2023-05-17 11:46:03,528:DEBUG:market_depth : {‘d’: {‘NSE:NIFTY23MAY18200PE’: {‘totalbuyqty’: 171000, ‘totalsellqty’: 145800, ‘ask’: [{‘price’: 114.35, ‘volume’: 700, ‘ord’: 1}, {‘price’: 114.4, ‘volume’: 1300, ‘ord’: 2}, {‘price’: 114.45, ‘volume’: 250, ‘ord’: 3}, {‘price’: 114.5, ‘volume’: 950, ‘ord’: 3}, {‘price’: 114.55, ‘volume’: 200, ‘ord’: 3}], ‘bids’: [{‘price’: 114.1, ‘volume’: 700, ‘ord’: 2}, {‘price’: 114.05, ‘volume’: 1400, ‘ord’: 3}, {‘price’: 114, ‘volume’: 2700, ‘ord’: 9}, {‘price’: 113.95, ‘volume’: 650, ‘ord’: 3}, {‘price’: 113.9, ‘volume’: 2250, ‘ord’: 6}], ‘o’: 70.05, ‘h’: 115, ‘l’: 64.55, ‘c’: 68.6, ‘chp’: 66.69, ‘tick_Size’: 0.05, ‘ch’: 45.75, ‘ltq’: 50, ‘ltt’: 1684304161, ‘ltp’: 114.35, ‘v’: 8256400, ‘atp’: 87.42, ‘lower_ckt’: 0.05, ‘upper_ckt’: 342.5, ‘expiry’: ‘1685025000’, ‘oi’: 0, ‘oiflag’: True, ‘pdoi’: 0, ‘oipercent’: 0}}, ‘message’: ‘’, ‘s’: ‘ok’}

Hi Anamika,
For the time being you cannot fetch OI data using the API

This will fetch only that particular symbol data, how about complete active weekly or monthly option chain at once?

@xGEOiW2SHe Is it in the roadmap ? if no, Can it be a feature request to include OI data ?

Sure @ashish_sharma1, your feedback is duly noted. Thanks!

@shruthi_shetty any update on the option chain API?

Hi @anil.tcq2yay5,

The mentioned feature is currently in the pipeline, and I will provide updates on its release accordingly. Stay tuned for further announcements!

Any update on this ?
Is it available now , asking for it as it has been 6 months since.

@abhinandan.patil.ih0a9bqj The OI data can be fetched for F&O contracts through API

I want to fetch OI data using Python, there is no document on the fyers website..

could you provide the link?

Anil

@anil.kzxqg358 You can run the Quotes / Depth API for FNO contracts to fetch the OI data