// onMessage function for onticks print("TICKER",tick_type, len(ticks)) publish_message(tick_type, ticks) //redis queue if (SAVE_TICKER and len(ticks)>100): print(ticks) ..db dave return
--- i'm adding ticks data to redis queue for further calculations.
// KITE CONNECT CODE
kws.on_ticks = onMessage kws.on_connect = on_connect kws.on_close = on_close kws.on_reconnect = on_reconnect # Infinite loop on the main thread. Nothing after this will run. # You have to use the pre-defined callbacks to manage subscriptions. kws.connect()
ISSUE : My ticker getting disconnected three of four times in a day with error ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
if i'm using kws.connect(threaded=True) then my ticker getting disconnected in minutes and connecting again
Please provide me solution what do i need to change in my implementation.
I'm using three tickers for kite and running in thread
No, you don't need to initiate ticker for each instrument. You can subscribe to a list of instruments in a single ticker up to 3000.
My ticker getting disconnected three of four times in a day with error ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
This error mostly occurs, when the main ticker `on_ticks` is blocked operating when receiving new ticks. This python project goes through in detail about tick async queue and insert.
This python project goes through in detail about tick async queue and insert.