OHLC Quotes V3 url not fetching prev_ohlc

I was trying to fetch prev_ohlc as well as live_ohlc using ohlc quote v3 url. it fetches live ohlc correctly but getting no prev_ohlc. neither it is showing any error nor warning

Full API Response Sample for first key: (‘NSE_EQ:BLUESTARCO’, {‘last_price’: 1959.0, ‘instrument_token’: ‘NSE_EQ|INE472A01039’, ‘prev_ohlc’: None, ‘live_ohlc’: {‘open’: 1987.0, ‘high’: 1987.0, ‘low’: 1951.1, ‘close’: 1959.0, ‘volume’: 35674, ‘ts’: 1760985000000}})

is it due to holidays or not optimised currently? But if it is due to holidays live ohlc too should display none or negative response

Hi @gaurav
It appears that you have called the OHLC API with a 1-day interval. For this interval, the previous OHLC will always be empty.

If you need the previous day’s OHLC, please use the Historical Candle API instead:
https://upstox.com/developer/api-documentation/v3/get-historical-candle-data

Thanks!

Hi @Ketan

I am actually using historical api for prev day close. But I saw this just yesterday that using ohlc api I can fetch previous day/session close also. I actually want to use same ohlc api to fetch current day ohlc and prev day ohlc for some reasons. Also, because I can get both via a single request.

ohlc api document also shows that using 1 day interval i can get both current and previous day ohlc

pasting the response body from ohlc api doc

{
“status”: “success”,
“data”: {
“NSE_FO:NIFTY2543021600PE”: {
“last_price”: 303.9,
“instrument_token”: “NSE_FO|51834”,
“prev_ohlc”: {
“open”: 303.9,
“high”: 304.3,
“low”: 303.85,
“close”: 304.3,
“volume”: 300,
“ts”: 1744019880000
},
“live_ohlc”: {
“open”: 304.45,
“high”: 304.45,
“low”: 302.75,
“close”: 303.9,
“volume”: 2250,
“ts”: 1744019940000
}
}
}
}

request url also states the same

data = {
“instrument_key”: “NSE_EQ|INE669E01016,NSE_EQ|INE848E01016”,
“interval”: “1d”
}

Please clear the confusion.