tick data

Ashok121
Ashok121 edited May 2018 in Python client
For below script, I am not getting different tick value for RL1, RL2 & RL3 however they fetch data at interval of 60 seconds and value remains same every time.
I need value of stock at every 60 seconds.
from kiteconnect import KiteTicker
kws = KiteTicker("my api key","my access token")

def on_ticks(ws, ticks):
M1=datetime.time(13,42,30,100000)
M2=datetime.time(13,43,0,100000)
today=datetime.date.today()
a=datetime.datetime.combine(today,M1)
b=datetime.datetime.combine(today,M2)
rt1=datetime.datetime.now()
if(rt1<b)and (rt1>a):
for tick in ticks:
RL1=tick['last_price']
print('RL1=',RL1)
time.sleep(60)
RL2=tick['last_price']
print('RL2=',RL2)
time.sleep(60)
RL3=tick['last_price']
print('RL3=',RL3)
ws.close()
def on_connect(ws,response):
ws.subscribe([738561])
ws.set_mode(ws.MODE_LTP, [738561])
def on_close(ws,code,reason):
ws.stop()
kws.on_ticks=on_ticks
kws.on_connect=on_connect
kws.on_close=on_close
kws.connect()close()
def on_connect(ws,response):
ws.subscribe([738561])
ws.set_mode(ws.MODE_LTP, [738561])
def on_close(ws,code,reason):
ws.stop()
kws.on_ticks=on_ticks
kws.on_connect=on_connect
kws.on_close=on_close
kws.connect()
Tagged:
This discussion has been closed.