ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (None)

taiyo
getting this error after some time. I do some processing on on_tick function. What all can be the possible reasons fro this.

Thanks
  • taiyo
    Can anyone please respond, and let me know if any more information is needed.
  • taiyo
    Also, can you let me know the limitations of API, i.e. on the number of orders that can be placed per tick, and other limitations? Is there any documentation present regarding the limits.
  • taiyo
    I didn't get error 1006 when I just print the tick on on_tick function, but I get the error I if start placing orders on on_tick function after some 10 minutes.
  • rakeshr
    @taiyo
    I didn't get error 1006 when I just print the tick on on_tick function, but I get the error I if start placing orders on on_tick function after some 10 minutes.
    You are blocking the main tick thread.You need to pass on the tick value to another thread from on_tick handler for any calculation, so main thread is not blocked.
  • taiyo
    what I did:

    f(): some function to place order

    fun on_tick(tick):
    f()
    print(tick)

    this caused the error, but if i comment f(), and only print the tick in on_tick then no 1006 error came
  • taiyo
    when we write, kws.on_ticks = fx, where fx(ticks) is some function, isn't it is non-blocking by default.
  • taiyo
    ERROR:kiteconnect.ticker: Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
  • rakeshr
    @taiyo
    this caused the error, but if i comment f(), and only print the tick in on_tick then no 1006 error came
    You are using f() in same thread, you need to kws.connect(threaded=True) and then pass on the value.You can check an example of mult-threading here.
Sign In or Register to comment.