Open shirishaardak opened 11 months ago
Are you able to get the historical data using enctoken?
you need to update from_datetime
and to_datetime
variables
here is the modified code
instrument_token = 9604354
from_datetime = datetime.datetime.now() - datetime.timedelta(days=7) # From last & days
interval = "5minute"
while True:
t.sleep(1)
if datetime.now().minute % 5 == 0 and datetime.now().second == 10:
to_datetime = datetime.datetime.now()
get_data = kite.historical_data(instrument_token, from_datetime, to_datetime, interval, continuous=False, oi=False)
print(get_data)
Are you able to get the historical data using enctoken?
Yes for 30 days only
you need to update
from_datetime
andto_datetime
variables here is the modified codeinstrument_token = 9604354 from_datetime = datetime.datetime.now() - datetime.timedelta(days=7) # From last & days interval = "5minute" while True: t.sleep(1) if datetime.now().minute % 5 == 0 and datetime.now().second == 10: to_datetime = datetime.datetime.now() get_data = kite.historical_data(instrument_token, from_datetime, to_datetime, interval, continuous=False, oi=False) print(get_data)
Thank A lot.... it work for me
Thank you @shirishaardak
Hlo how can i get the instrument token for other things like stock
for Ex. instrument_token = 9604354 from_datetime = datetime.datetime.now() - datetime.timedelta(days=7) # From last & days to_datetime = datetime.datetime.now() interval = "5minute" while True: t.sleep(1) if datetime.now().minute % 5 == 0 and datetime.now().second == 10: get_data = kite.historical_data(instrument_token, from_datetime, to_datetime, interval, continuous=False, oi=False)
print(get_data)