Issue while fetching Put/Call option chain data using Upstox API

I’m trying to fetch data from the API using the following Python code…

import requests

access_token = "my-access-token" #used the real access token ofc
optionsUrl = "https://api.upstox.com/v2/option/chain"

params = {
    'instrument_key': 'NSE_INDEX|Nifty 50',
    'expiry_date': '2024-11-07'
}
headers = {
    'Accept': 'application/json',
    'Authorization': f'Bearer {access_token}'  # Ensure correct token format
}

response = requests.get(optionsUrl, headers=headers, params=params)

print(response.json())

But all I am getting in reponse this…

{'status': 'success', 'data': []}

What could be the reason behind it?

1 Like