Hi, Is there any api to get previous day close price of Gift Nifty? Close price using this api kite.historical_data(291849, stTime, edTime, 'day') doesn't match with the one displayed in Zerodha. Or Is there any specific time that we need to get the previous day price?
I see kite.quote giving the previous day close price. kite.quote(['NSEIX:GIFT NIFTY'])['NSEIX:GIFT NIFTY']['ohlc']['close'] But why is kite.historical api (interval='day') data doesn't match with that of kite.quote
Hi, kite.historical_data(291849, stTime, edTime, 'day') data does not match with that of kite.quote date open high low close volume 0 2025-05-29 00:00:00+05:30 24762.5 24990.5 24658 24918.5 0 1 2025-05-30 00:00:00+05:30 24950.0 24975.5 24801 24897.0 0
The GIFT Nifty Index operates in two trading sessions: the first from 6:30 a.m. to 3:40 p.m., and the second from 4:35 p.m. to 2:45 a.m. the following day, as per IST.
The Quote API provides live market data at the time of the request, provided the market is open. In contrast, the historical_data API returns historical data.
To retrieve the previous day's close price, you can use the historical_data API. This value should align with the corresponding candle on the Kite chart.
For GIFT NIFTY, there is a difference because the historical API data provides the LTP as the close price, and currently, there isn't a separate process to update the closing price. Typically, historical OHLC data can be obtained via the historical API call. However, in this situation, you may want to refer to the OHLC data retrieved from the Quote call.
Thanks for the update. But I see NIFTY and SENSEX too are having different values. After market hours say at 4PM, kite.quote - gives the previous day close price kite.historical_data (291849, datetime.datetime(2025, 7,15), datetime.datetime(2025, 7,15), 'day') - gives the current day close price. So at what time does kite.quote api gets updated with the previous day value.
kite.historical_data (256265, datetime.datetime(2025, 7,16), datetime.datetime(2025, 7,16), 'day') - returns 25198.55 as the close price. Now this value when checked tomorrow will have a different value which will match the value returned by kite.quote api. Please let us know when does the value change?
For NIFTY and SENSEX, it is not possible to get the same-day close via the Kite Connect API at the moment. However, you can retrieve the closing price data the next morning on the following working day. Both the Quote and Historical API calls should reflect the same closing price.
kite.quote(['NSEIX:GIFT NIFTY'])['NSEIX:GIFT NIFTY']['ohlc']['close']
But why is kite.historical api (interval='day') data doesn't match with that of kite.quote
kite.historical_data(291849, stTime, edTime, 'day') data does not match with that of kite.quote
date open high low close volume
0 2025-05-29 00:00:00+05:30 24762.5 24990.5 24658 24918.5 0
1 2025-05-30 00:00:00+05:30 24950.0 24975.5 24801 24897.0 0
whereas kite.quote(['NSEIX:GIFT NIFTY'])['NSEIX:GIFT NIFTY']['ohlc']['close']
24908.5
Is there any particular time that the previous close price needs to be checked for?
Can someone help with this?
The Quote API provides live market data at the time of the request, provided the market is open. In contrast, the historical_data API returns historical data.
To retrieve the previous day's close price, you can use the historical_data API. This value should align with the corresponding candle on the Kite chart.
kite.historical_data(291849, datetime.datetime(2025, 6, 6, 9, 15), datetime.datetime(2025, 6, 7, 2, 50), 'day') - this gives 25153.5 as the previous close price.
There is a discrepancy. Please guide.
kite.quote(['NSEIX:GIFT NIFTY'])['NSEIX:GIFT NIFTY']['ohlc']['close'] - When I run this now gives a value 25174 which is previous day close price.
kite.historical_data(291849, datetime.datetime(2025, 7,14), datetime.datetime(2025, 7,14), 'day') - this gives 25171.5 as the previous close price.
This issue is only with Giftnifty. NIFTY & SENSEX have same values for both the apis
After market hours say at 4PM,
kite.quote - gives the previous day close price
kite.historical_data (291849, datetime.datetime(2025, 7,15), datetime.datetime(2025, 7,15), 'day') - gives the current day close price.
So at what time does kite.quote api gets updated with the previous day value.
Please let us know when does the value change?