5-min OHLC data of Nifty 50 is showing huge variations when I am pulling it from Historical Data API & comparing it on Kite charts.
In 2020-11-05 09:30:00+05:30 data below, you can see Data API is giving same values for Open & High candle, while actually there was a 10 point difference as per Kite Charts.
Why such high discrepancy in data? I understand because of multiple ticks, data may not exactly match but so much variation makes Data API useless. What is the point of subscribing to Data API when it is not even close to actual market movement?
Historical Data API - date open high low close volume 2020-11-05 09:15:00+05:30 12062.4 12074.55 12055.3 12064.4 0
Kite Charts - date open high low close volume 2020-11-05 09:15:00+05:30 12062.4 12074.55 12046.15 12051.5 0
We checked for this and Historical data APIs is showing fine. {'date': datetime.datetime(2020, 11, 5, 9, 15, tzinfo=tzoffset(None, 19800)), 'open': 12062.4, 'high': 12074.55, 'low': 12046.15, 'close': 12051.5, 'volume': 0} Both Kite Web and Historical Data APIs uses same DB source for candle formation. So, difference can't arise until there is some computation at your end.
Thanks for reply. I debugged further basis your revert.
data = kite.historical_data(instrument_token, from_time, from_time, constants.CANDLE_5MIN)
When I give from_time & to_time same values in above API call (say either 9:15 am or 9:20 am or 9:25 am...and so on), I get only 1 output for given timeframe but candle OHLC values turn out to be incorrect.
However when I give from_time as 9:15 am & to_time as 9:20 am, I start getting 2 output for each API call, out of which only first value is correct. 2nd one is again wrong.
------ ------ date open high low close volume [~~right~~] 2020-11-05 09:15:00+05:30 12062.4 12074.55 12046.15 12051.50 [~~wrong~~]2020-11-05 09:20:00+05:30 12052.6 12065.85 12052.60 12055.45
date open high low close volume [~~right~~] 2020-11-05 09:20:00+05:30 12052.6 12065.85 12040.15 12041.7 [~~wrong~~]2020-11-05 09:25:00+05:30 12040.8 12048.25 12035.70 12040.4
date open high low close volume [~~right~~]2020-11-05 09:25:00+05:30 12040.80 12050.25 12035.7 12042.85 [~~wrong~~]2020-11-05 09:30:00+05:30 12046.35 12046.35 12028.4 12033.25 ------ ------
Questions - 1) Is there a way to get only 1 correct value in a API call made for a 5-min candle from Data API? 2) Or do I have to do like above where I have to keep from_time & to_time as separate & consider first value, discard 2nd value? Sounds twisted & error prone.
You would know 20 point difference in Nifty 50 data means a lot!
{'date': datetime.datetime(2020, 11, 5, 9, 15, tzinfo=tzoffset(None, 19800)),
'open': 12062.4, 'high': 12074.55, 'low': 12046.15, 'close': 12051.5, 'volume': 0}
Both Kite Web and Historical Data APIs uses same DB source for candle formation. So, difference can't arise until there is some computation at your end.
Thanks for reply. I debugged further basis your revert. When I give from_time & to_time same values in above API call (say either 9:15 am or 9:20 am or 9:25 am...and so on), I get only 1 output for given timeframe but candle OHLC values turn out to be incorrect.
[~~~WRONG VALUES~~~]
------
------
2020-11-05 09:15:00+05:30 12062.4 12074.55 12055.3 12064.4
2020-11-05 09:20:00+05:30 12052.6 12065.85 12052.6 12055.45
2020-11-05 09:25:00+05:30 12040.8 12048.25 12035.7 12040.4
------
------
However when I give from_time as 9:15 am & to_time as 9:20 am, I start getting 2 output for each API call, out of which only first value is correct. 2nd one is again wrong.
------
------
date open high low close volume
[~~right~~] 2020-11-05 09:15:00+05:30 12062.4 12074.55 12046.15 12051.50
[~~wrong~~]2020-11-05 09:20:00+05:30 12052.6 12065.85 12052.60 12055.45
date open high low close volume
[~~right~~] 2020-11-05 09:20:00+05:30 12052.6 12065.85 12040.15 12041.7
[~~wrong~~]2020-11-05 09:25:00+05:30 12040.8 12048.25 12035.70 12040.4
date open high low close volume
[~~right~~]2020-11-05 09:25:00+05:30 12040.80 12050.25 12035.7 12042.85
[~~wrong~~]2020-11-05 09:30:00+05:30 12046.35 12046.35 12028.4 12033.25
------
------
Questions -
1) Is there a way to get only 1 correct value in a API call made for a 5-min candle from Data API?
2) Or do I have to do like above where I have to keep from_time & to_time as separate & consider first value, discard 2nd value? Sounds twisted & error prone.
Thanks
-Ankur