Fetching Options historical data under chart

fetching using below api doc

with below request
{
“symbol”: “NIFTY23OCTFUT”,
“exchangeSegment”:“NSE_FNO”,
“instrument”: “INDEX”,
“expiryCode”: 0,
“fromDate”: “2023-10-08”,
“toDate”: “2023-10-13”
}

data comes empty
{}

what could be wrong here? does this api from options data for specific strike prices ?

thanks

Hello, did you find you the solution? I am also facing similar problem but in case of MCX futures historical data.

data = dhan.historical_minute_charts(symbol = ‘GOLDGUINEA-30Nov2023-FUT’, exchange_segment=‘MCX_COMM’, instrument_type=‘FUTCOM’, expiry_code=0,from_date=‘2023-11-01’,to_date=‘2023-11-16’)

In [6]: data
Out[6]: {‘status’: ‘success’, ‘remarks’: ‘’, ‘data’: {}

Hi @vinodtakhar

You are using Daily Historical data api to fetch the options charts. Daily charts are not available for options. The instrument for index options is OPTIDX and that is not the allowed enum for the field. For options, you can use the intraday historical data api, which gives you 1 minute OHLC for the current day.

Can you provide a sample for Bank Nifty Option weekly strike price

Hello @Praveeka

Welcome to Dhan Community!

Here’s an example for Options Contract

{
“securityId”: “35050”,
“exchangeSegment”: “NSE_FNO”,
“instrument”: “OPTIDX”
}

This is for BankNifty 25 Jan 55000 CE contract. Hope this helps.

THIS DOESNT WORK FOR OPTION STOCK, PROVIDE APPROPRIATE SAMPLE FOR FETCHING HISTORICAL DAILY DATA FOR OPTION STOCK

E.G.:
dhan.historical_daily_data(
symbol=‘GUJGASLTD 29 FEB 360 PUT’,
exchange_segment=‘NSE_FNO’,
instrument_type=‘OPTSTK’,
expiry_code=0,
from_date=‘2024-01-01’,
to_date=‘2024-01-10’
)

Output for this:
{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘RS-9005’, ‘message’: None}, ‘data’: ‘’}

Hey @Praveeka

Currently we do not provide historical data for Stock Option contracts. You can refer to documentation for exchange_segment which is eligible - here.