Historical data for Midcap Nifty, gives blank output

Is MidCap Nifty options historical data not available on upstox API v2.0? I am trying below code to get the historical data for midcap nifty option:

url = ‘https://api-v2.upstox.com/historical-candle/NSE_FO|46579/1minute/2023-10-13/2023-10-10

headers = {
‘accept’: ‘application/json’,
‘Api-Version’: ‘2.0’
#‘Authorization’: f’Bearer {access_token}’
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
# The API request was successful
data = response.json()
# You can work with ‘data’ which contains the JSON response from the API
print(data)
else:
print(f"Failed to fetch data. Status code: {response.status_code}")

Output received is:

{‘status’: ‘success’, ‘data’: {‘candles’: }}

@harsh_srivastava

It appears that the contract fetched under the instrument_key NSE_FO|46579, specifically MIDCPNIFTY 7800 CE 16 OCT 23, has already reached its expiration. Notably, there were no trades conducted on this contract as of yesterday, resulting in an empty candles object.

Please inform us if you encounter a similar scenario with other in-the-money contracts. We are happy to assist you with any concerns or inquiries you may have.

Thanks!!

Is there a way to get the historical data for expired contracts? like the one above or below url/request:
url = f’https://api-v2.upstox.com/historical-candle/NSE_FO|40734/30minute/2023-11-01/2023-11-02

The data regarding the expired contracts is currently unavailable. We are in the process of making this information accessible in the future. You will be notified once it becomes available for use.

Thanks a lot. Looking forward to that.

1 Like