Hi, I am facing an issue with historical api when fetching brief periods : for example 09:15 AM to 09:20 AM. In this case, the candles do not show the accurate data and it does not match with the candle data that is fetched for the full day.
For example for IDFCB : Period Wise : INFO:root:Open : 20.3 , High : 20.4 , Low : 20.25 , Close : 20.3, Volume : 1167259 , Date : 2020-05-28 09:15:00+05:30 INFO:root:Open : 20.3 , High : 20.35 , Low : 20.25 , Close : 20.25, Volume : 439879 , Date : 2020-05-28 09:20:00+05:30
Date Wise : INFO:root:Open : 20.4 , High : 20.4 , Low : 20.1 , Close : 20.3, Volume : 1779830 , Date : 2020-05-28 09:15:00+05:30 INFO:root:Open : 20.3 , High : 20.5 , Low : 20.2 , Close : 20.4, Volume : 1803066 , Date : 2020-05-28 09:20:00+05:30
As you can see the close price, volume etc for 09:20 Candle are completely off.
In this case, the candles do not show the accurate data and it does not match with the candle data that is fetched for the full day.
No, it won't match as there is a difference in the time period(to and from param) for the second 5-minute candle(09:20 - 09:25) in both the requests. If you want complete 5-minute candle data of 09:20, you need to send to param as last tick time(here 09:24:59) of that particular candle. Eg. For first two 5 minute candle kite.historical_data(instrument_token='2863105', from_date='XXXX-XX-XX 09:15:00', to_date='XXXX-XX-XX 09:24:59', interval="5minute")
Thanks for the quick response.
Period Wise :
"GET /instruments/historical/2863105/5minute?instrument_token=2863105&from=2020-05-28+09%3A15%3A00&to=2020-05-28+09%3A20%3A00&interval=5minute&continuous=0 HTTP/1.1"
Response: 200 b'{"status": "success", "data": { "candles":[["2020-05-28T09:15:00+0530",20.4,20.4,20.1,20.3,1779830],["2020-05-28T09:20:00+0530",20.3,20.35,20.25,20.25,439879]]}}'
Date Wise :
"GET /instruments/historical/2863105/5minute?instrument_token=2863105&from=2020-05-28&to=2020-05-28&interval=5minute&continuous=0 HTTP/1.1"
Response: 200 b'{"status": "success", "data": { "candles":[["2020-05-28T09:15:00+0530",20.4,20.4,20.1,20.3,1779830],["2020-05-28T09:20:00+0530",20.3,20.5,20.2,20.4,1803066]
to
andfrom
param) for the second 5-minute candle(09:20 - 09:25) in both the requests.If you want complete 5-minute candle data of 09:20, you need to send
to
param as last tick time(here09:24:59
) of that particular candle.Eg. For first two 5 minute candle
kite.historical_data(instrument_token='2863105',
from_date='XXXX-XX-XX 09:15:00', to_date='XXXX-XX-XX 09:24:59',
interval="5minute")