History Data not fetching for today i.e 2023-08-18

import requests
import json
import config as l
ip = input(“Enter the stock instrument key :”)
url = f"https://api-v2.upstox.com/historical-candle/NSE_EQ|{ip}/1minute/2023-08-18"

headers = {
‘accept’: ‘application/json’,
‘Api-Version’: ‘2.0’
}

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

if response.status_code == 200:
data = response.json()
# Save JSON response to a file
f2 = input(“What to name the .json file :”)
with open(f2, ‘w’) as json_file:
json.dump(data, json_file, indent=4)
print(f’JSON response saved to {f2}')
else:
print(f"Request failed with status code: {response.status_code}")

The above code os to fetch the candlestick data for 1min timeframe
I’m trying to run this on the evening of 2023-08-18 but the output doesn’t contain any data for 18th its giving the data from 17th

Is this some issue with the Upstox API or am I going wrong with the code ?

Hi @Niraj_Kamble,

Welcome to the Upstox community!

I have passed on your query to the concerned team and they will get back to you soon.

Thanks.

@Niraj_Kamble

You might want to use the intraday specific end-point to fetch data for today. Following should help you get today’s candles.

https://api-v2.upstox.com/historical-candle/intraday/{instrumentKey}/{interval}

Conversely, the historical-candle endpoint you’ve been employing will retrieve past data as required.

Hope this is helpful.

Let us know in case of issues.

Thanks