help me get data periodically

Balaganga
from kiteconnect import KiteConnect
import time
from kiteconnect import KiteTicker
from datetime import datetime



api_key="exxxxxxxxxxxxxx5"
access_token="3xxxxxxxxxxxxxxxxxxxxxxxxxxxxx4w3"


kws = KiteTicker(api_key,access_token)
tokens=[66048775,65113863,66717959]
dict={66048775:'CRUDEOIL23DECFUT',65113863:'SILVERM24FEBFUT',66717959:'GOLDM24JANFUT'}
def on_ticks(ws, ticks):
ticks=[dict[ticks[0]['instrument_token']],ticks[0]['timestamp'],ticks[0]['last_price']]
print(ticks)

def on_connect(ws, response):
ws.subscribe(tokens)
ws.set_mode(ws.MODE_FULL,tokens)


kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.connect(threaded=True)
count=0
while True:
count+=1
if(count%2==0):
if kws.is_connected():
kws.set_mode(kws.MODE_FULL,tokens)
else:
if kws.is_connected():
kws.set_mode(kws.MODE_FULL,tokens)
time.sleep(0.350)



No output is displaced in any platform

Can anyone help.
Sign In or Register to comment.