How to restart kite ticker connection

vijay95 edited May 22 in Python client
I'm looking to restart kite ticker connection. Can anyone suggest correct method to restart.
Periodically data stops receiving from the ticker service at certain time period after 1 pm. I have subscribed around 60 instruments daily and my on_ticks function are as per the guideline. Every tick data is added to queue and the data from queue is processed in another thread.
Even today the data didn't receive from ticker after 03:03 pm. Till that everything works perfect without any errors. So i decided to restart the ticker service incase of data not receiving for some time. Kindly help me with this or suggest any alternative.
Note : I didn't even receive on_error or any call back function in this case. Everything seems perfect.
  • sujith
    pykiteconnect comes with reconnect support. You don't have to do anything, library itself takes care of reconnection and re-subscribes after reconnect. You can check out documentation to know how to enable it.
  • vijay95
    vijay95 edited May 22
    Hi @sujith, I haven't overridden the default values in KiteTicker class. Whenever I gets error like network failure it reconnects itself automatically.
    My query is data stops receiving after some time in ticker. Can you suggest a solution for this. My ticker is started using threaded=True and all the call backs are properly assigned. Everything works perfect but only issue as i mentioned above.
    Also Can you tell me the maximum time delay between ticks that I receive from Kite...?
  • rakeshr
    My query is data stops receiving after some time in ticker.
    If the contract is active (with ticks) and there is no disconnection, this scenario won't occur. However, there might be disconnections due to errors, which would be displayed in the on_error callback. Please ensure that you have correctly added the on_error callbacks. Here is an example of the threaded ticker implementation with appropriate callbacks.
  • vijay95
    Thanks @rakeshr for your quick reply. I always subscribe weekly options in bank nifty and those are always active. I also used to receive disconnection call back error whenever there is one - from this i can surely say that i have properly set my call backs. In my case i didn't receive any. I have almost waited for more than 30 sec and even is_connected() returns true but no new ticks receiving. Any suggestion / feedback will be helpful. Thanks in advance.
  • rakeshr
    I have almost waited for more than 30 sec and even is_connected() returns true but no new ticks receiving
    Is it possible, to check the same contract ticks from another source? Maybe check kite web marketwatch depth during the same time, just to verify if there is a tick coming during that specific issue period.
    I don't see any other reason if the disconnection log shows no error, and the contract is active.
  • vijay95
    vijay95 edited May 24
    Thanks @rakeshr for your reply. Will debug from my end further and let you guys know the result in this thread.
  • vijay95
    vijay95 edited May 24
    Hi @rakeshr @sujith. Again today faced the same issue - ticker stops at 11:52 and is_connected() returns TRUE.
    After restarting my entire server it works. I have included logger in the on_ticks method.
    Attached the logs along with this.
    Any help would be more appreciated.
    Subscribed Tokens - [260105, 9210626, 8974082, 18624258, 18627842, 18624002, 18621698, 9219330, 18621186, 18623234, 18619138, 8983298, 18620162, 18604290, 18601730, 9198082, 9049858, 18622722, 18862850, 18628354, 18849026, 18849282, 18845698, 18624514, 18623746, 18860290, 18611202, 18847746, 18894850, 18627330, 18826498, 18863362, 9048322, 18896642, 18618626, 18839554, 18864898, 18845186]

  • sujith
    Can you remove onNewTicks and just keep logging for the day? Try on an alternate network also wherein you only log tick received and not do anything else.
    Kite Ticker is being used on our internal apps and 1000s of production Kite Connect apps, we don't see any issue from our end. If ticks stops then it will stop for everyone, not just for one connection.
  • vijay95
    vijay95 edited May 25
    ok thank you, will check @sujith
Sign In or Register to comment.