Hi All,
I need to fetch 3 years of historical data for Natural Gas Futures (all monthly expiries) via API. Please clarify the following:
-
Data Availability: Does the /v2/charts/historical endpoint support data for expired MCX contracts?
-
Security IDs: Where can I find the security_id for contracts that have already expired (2023–2025), as they no longer appear in the daily security master?
Thanks for your help!!
Hello @Mukund_Ranjan ,
Please note that expired futures contract data is not available via our APIs.
Intraday data for futures can be fetched only while the contract is active, starting from the contract date up to the current date.
However, daily data for futures is available in a continuous format. Using the continuous futures instrument, daily OHLC data can be fetched from inception till the current date, as the data is rolled across expiries using https://dhanhq.co/docs/v2/historical-data/#daily-historical-data.
Security IDs for expired contracts are removed from the security master, so they are no longer available separately. For historical analysis, the continuous futures security ID should be used.