I have noticed that intraday candle data pooled via API behaves differently for different segments. For example, for MCX future contract, the 1min candle data obtained is till last closed candle and currently forming candle in live market is ignored while doing the same for Nifty 50 Index, I am getting data for the latest candle which is not yet closed.
Is it right behavior or am i doing some mistake?
The code used is:
import requests
url = ‘https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ|INE848E01016/minutes/1’
headers = {
‘Content-Type’: ‘application/json’,
‘Accept’: ‘application/json’,
‘Authorization’: ‘Bearer {your_access_token}’
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")