how close connection cleanly after kites intraday market hours let's say after 3:15pm

atulmishra
I followed the example given in this thread https://kite.trade/forum/discussion/7399/kiteconnect-ticker-connection-error-1006-connection-was-closed-uncleanly-none

But not able to close or stop the connection cleanly after market hours. I need success status after the 3:15pm but not able to get so by kws.close() or kws.stop().

  • sujith
    You need to call unsubscribe for the already subscribed tokens and then call stop.
  • atulmishra
    Thanks. Will try.
  • rajista
    I am trying to do the similar thing. But so far no success. Once we execute kws.connect an infinite loop starts. And the callback function on_close is only called when the main function stops receiving all the ticks and that includes post market hours as well, so it extends till 5pm i think. So i don't think there is any solution for this, except force closing the program
Sign In or Register to comment.