Is it possible to get FnO OI and volume data from past ?
Hi @coolcoder,
You can get OI and volume from historical candle API - link
Additonally, OI data is available in Market Quote and Websocket section also in the same documentation.
Hope this helps.
Hi @AbhishekRathore , thanks for your prompt response.
I downloaded the csv file from this link Instruments.
But , I can see the expiry date as of 2023 and 2024. How to get instrument key for historical dates as 1 min / 5 min / 15 min data ?
Is it possible to send trading symbol like r"FINNIFTY\d{2}[A-Z]{3}FUT"
as parameter in any historical API ?
Instrument keys are not constrained by specific historical periods, and the time interval can be adjusted to various durations such as 1 minute
, 30 minutes
, day
, week
, or month
. 5 minutes & 15 minutes data is not available as of now.
Expired contracts are not part of instruments and not possible to fetch data for expired contracts.
The historical API accepts both the instrument and the interval as query parameters and date specifications.
For more information, refer to: Upstox Historical Candle Data API Documentation.
Hi @Pradeep_Jaiswar ,thanks a lot for response.
I am trying the following code to the API url = "https://api-v2.upstox.com/historical-candle/:instrument_key/:interval/:to_date/:from_date"
payload={
"instrument_key": "NSE_FO|48289",
"interval": "1minute",
"from_date": "2023-04-01",
"to_date": "2023-10-31"
}
headers = {
'Accept': 'application/json',
'Api-Version': '2.0'
}
But , I am getting error message as
{"status":"error","errors":[{"errorCode":"UDAPI1020","message":"Interval accepts one of (1minute,30minute,day,week,month)","propertyPath":"getHistoricalCandleData.interval","invalidValue":":interval","error_code":"UDAPI1020","property_path":"getHistoricalCandleData.interval","invalid_value":":interval"},{"errorCode":"UDAPI1021","message":"Instrument key is of invalid format","propertyPath":"getHistoricalCandleData.instrumentKey","invalidValue":":instrument_key","error_code":"UDAPI1021","property_path":"getHistoricalCandleData.instrumentKey","invalid_value":":instrument_key"}]}
In Python, when making a GET request using libraries like requests, you typically pass parameters in the URL or as query string parameters rather than in a JSON payload. JSON payloads are typically not used with GET requests because the HTTP specification implies that GET requests should not have a message body.
Please append all the parameters to the url and try again.
Thanks for your support . It works.