The formulae for historical data is def historical_data(self, instrument_token, from_date, to_date, interval, continuous=False, oi=False)
How shall I get the historical data for current ,middle month and far month futures till these are active contracts.. The problem is that I cant find the instrument token for a particular expiry month in the API call def instruments(self, exchange=None) Calling this function gives instrument token for cash stocks and not futures stock for any expiry.
The keyword argument can be put to continuous = 1 and oi = 1. but what about instrument token for that stock for current expiry.
Also how to get the data for compete option chain for any contract. GIve an example for the same.
Calling this function gives instrument token for cash stocks and not futures stock for any expiry.
You need to fetch instrument token for required F&O instrument and then request for historical data using that instrument token. You need to retrieve the full instrument token.
How shall I get the historical data for current ,middle month and far month futures till these are active contracts.. The problem is that I cant find the instrument token for a particular expiry month in the API call.
You can use current month instrument token and request continuous data to get day candles for expired contracts. Only day candle is available for continuous data no intraday interval. You can go through this part of documentation to know more about continuous data. Go through this post as well. Also, continuous data is available only for future contracts not for option contracts.
Also how to get the data for complete option chain for any contract.
No, we don't provide direct endpoint for the Option chain. Maybe you can, loop through all the required contract/strike, fetch its OI value, and form the option chain at your end using Websocket streaming.
You need to retrieve the full instrument token. You can use current month instrument token and request continuous data to get day candles for expired contracts. Only day candle is available for continuous data no intraday interval. You can go through this part of documentation to know more about continuous data. Go through this post as well.
Also, continuous data is available only for future contracts not for option contracts. No, we don't provide direct endpoint for the Option chain. Maybe you can, loop through all the required contract/strike, fetch its OI value, and form the option chain at your end using Websocket streaming.