It looks like you're new here. If you want to get involved, click one of these buttons!
from kiteconnect import KiteConnect
# Set API_KEY and ACCESS_TOKEN to your credentials.
# 260105 is the symbol token for Bank Nifty.
def Test():
API_KEY = ''
ACCESS_TOKEN = ''
kc = KiteConnect(API_KEY, ACCESS_TOKEN)
for c in kc.historical_data(260105, '2021-03-30', '2021-07-07', '5minute'):
candle = [
c['date'].strftime('%Y-%m-%dT%H:%M:%S+0530'),
c['open'],
c['high'],
c['low'],
c['close'],
c['volume']
]
print(candle)
Test()
I saved the code above in a file named failure.py. Then I run this from the (Linux) command line:
https://kite.trade/forum/discussion/9961/day-historical-data-is-different-for-same-date-if-the-start-end-date-change#latest
If all of this is "working as intended", an explanation as to why that is so would be welcome.
I understand that the Kite connect API / Historical APIs are a "no guarantees" and "use at your own risk" type of products. But those typically imply availability (occassional server errors and such) guarantees. You have to guarantee something. For example, sending bad / inconsistent data like what is happening here is definitely a terrible thing, because this is a silent and dangerous error. I happened to notice it in my logs by sheer accident. Your other clients apparently have not noticed this. And how can they? We make the implicit (and valid) assumption that the data the broker gives us is correct . The error above is probably also manifest in Kite Web, but then, which discretionary trader is going back a few months on a 5 minute chart and how can they even know if some candles are bad?
These have serious ramifications for algorithmic trading, where data is the starting point of everything - backtesting, statistical analysis, etc, etc. If I cannot trust the data, my backtest could be totally bogus, generating false entries and exits.
Furthermore, the reason I posted this under "General" is that I suspect that this is a backend issue at your end and not tied to any client API in any language.
You can create candles at your end from websocket. Go this this thread.