Kite ticker websocket suddently crashes without error

pavanss83
pavanss83 edited September 2019 in Python client
# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.on_error = on_error
kws.on_reconnect = on_reconnect
kws.on_noreconnect = on_noreconnect
kws.on_order_update = on_order_update
# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
logging.info("Starting Kite-Ticker connect...")
kws.connect()
logging.info("Kite connect infinite loop exited for some reason")
I have been mining kite ticker data for 1 stock but my program all of a sudden closes without any error. The below command line starts my program in background and stores logs in a file.
python3 websocket.py > info.log 2>&1 &

I have even enabled kite ticker debug using kws = KiteTicker(apiKey, accessToken, debug=True), which prints ping ,pong logs.
I have also added logging messages in all the above call backs.

But....
1. My program exists (usually runs fine for 30 mins to 2 hrs before exiting), and no call backs (on_error, on _reconnect, on_noreconnect...) are called (no message printed)
2. I get the messages about web socket started and "Starting Kite-Ticker connect" which is printed just before kws.connect()
3. I dont see the log message "Kite connect infinite loop exited for some reason"


From these, I'm thinking that the kws.connect crashed, but there is no message. Was this issue faced by anyone, if yes, then what is the solution ?


  • sujith
    If you getting data properly and then it suddenly stops then I would suggest checking your system sleep time.
  • pavanss83
    Its a linux machine running on aws - the system does not sleep. I'm not sure if that is what you meant.
  • Vivek
    Can you please share the logs you have collected by enabling debug mode?
  • ZI4453
    ZI4453 edited September 2019
    is thats the case then your connection was interrupted from server end(brokers), you need to check your data path and figure out if your network is occupied.
    moroever since this is hosted in aws, i would recommend you to check this script in local desktop first for debugging.. only then we can conclude issue origination.
  • decoder_12
    Full Zerodha Algo Trading Tutorial :
  • tahseen
    @pavanss83
    You have not show your on_ticks function, which might be the culprit depending on how it has been written
Sign In or Register to comment.