Hello @sujith How should I disconnect from KiteTicker(close websocket connection) at say 15:30 and reconnect again at login, without checking if time is xx:xx every few seconds
Edit: reconnect at login, i already have working smooth, just the disconnect step at 15:30 is bugging me, any hints about that are appreciated.
How should I disconnect from KiteTicker(close websocket connection) at say 15:30 and reconnect again at login, without checking if time is xx:xx every few seconds
There is no individual API on this, you will have to build this logic at your end wrapped over stop() call to disconnect the ticker.
The following works pretty well for me in Python, I add this piece of code at the end of my main code in a threaded websocket connection:
import datetime if datetime.datetime.now().hour>=hour: ----if datetime.datetime.now().minute>=minute: --------# Your position exiting code --------# Your position exiting code ----kws.stop() ----kws.unsubscribe(tokens) ----kws.close() ----raise SystemExit
import datetime
if datetime.datetime.now().hour>=hour:
----if datetime.datetime.now().minute>=minute:
--------# Your position exiting code
--------# Your position exiting code
----kws.stop()
----kws.unsubscribe(tokens)
----kws.close()
----raise SystemExit
inside on_ticks or
helper function called from on_ticks