For example, AFFLE had its IPO in July of 2019. For any from_date < IPO date, we should expect an empty list as the output. But for some reason I get a non-zero junk data for range 2015-03-07 to 2015-05-06 See below code snippet.
To Recreate:
In [2]: import datetime
In [3]: from_date = datetime.datetime(2015, 3, 7)
In [4]: to_date = datetime.datetime(2015, 5, 6)
In [5]: token=2903809
In [6]: data = kite.historical_data(token, from_date=from_date, to_date=to_date, interval='5minute')
Seems like instrument token (2903809) might have been assigned to some other instrument during that period by exchange and it might not be trading now. This is a known issue. exchange assigns defunct token to new instruments. Will let you know when we come up with some fix.
One solution might be to return the instrument name along with the ohlc data. This way user can cross check if he is receiving the data for the desired instrument.
This way user can cross check if he is receiving the data for the desired instrument.