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 ?
Is there any specific reason for not adding current day in historical data? as we need to call multiple APIs to get historical and intraday data together.
@Jagdish_j_ptl The Intraday API is frequently used to serve the latest data and has a smaller data size compared to historical data. It doesn’t make sense to send large historical (static) data every time alongside intraday data. You can cache the historical data once daily.