fetching using below api doc
Historical API gives you historical candle data, timestamp, open, high, low, close & volume for the desired scrip across segments & exchange. Learn more about Historical Data API on DhanHQ API Docs.
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’: {}
Naman
November 20, 2023, 4:40am
3
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
Hardik
January 24, 2024, 5:31am
5
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’: ‘’}
Hardik
January 29, 2024, 5:30am
7
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 .
vinodtakhar:
“2023-10-08”,
how to fetch data using FNO symbol to get security id ?
Hardik
August 14, 2024, 1:20pm
9
Hey @bharathi_komaravolu
Can you clarify a bit more here. Are you looking to fetch the symbol name or the security ID from the list?