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

pranavwagh
Hello Experts,

Today, I got a lot of these errors. Any specific reason why? Nothing is changed in the code and after the errors when the retry happens, everything works fine again

Regards,
Pranav Wagh
  • pranavwagh
    Nope, not related to my issue below is entire code from my on_tick:

    ==
    # Callback for tick reception.
    def on_ticks(ws, ticks):
    data["ticks"]=ticks
    ==
  • SRIJAN
    SRIJAN edited March 2022
    If you're not doing any computations and still,this error is happening, it maybe due to some network problems. Actually,this error happens when it takes more than the time between two ticks by the on_ticks function to respond.
  • pranavwagh
    Okay, possibly .. Thanks! It helps. I'll see the pattern, and hopefully it wouldn't reoccur. However, if it does, I'll cycle back to you.

    Kudos to your speed and of response @SRIJAN
  • DD1365


    But if we are using kite ticker in threaded mode, then delay in main function code must not generate such error in the on_ticks function response, right?
  • SRIJAN
    This error won't happen in threaded ticker no matter how much time it takes in the second thread. As long as you don't block the streaming in the main on_ticks thread. What's happening is the input coming from the websocket is being received consistently by the program and the processing of ticks is done in another thread asynchronously. But if you don't use threading and process ticks directly in main on_ticks,and if the processing is still going,while another tick is coming,the program can't receive it(connection abrupted) and so the server throws this error.
  • DD1365
    Thanks for Sunday night response @SRIJAN I understand what you are saying, and that's why I have been using threaded ticker in my code, but still I couldn't understand why I am receiving //ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly// on daily basis once or twice since past week, earlier there wasn't any such error message being received on the same code that I have been running since many months.. Although the code isn't breaking in any of my accounts because I have appropriate control mechanisms built in place, but I just hope it doesn't break someday because of this error..
  • DD1365
    @SRIJAN Also, can you help me understand if for any account we can get any custom permissions from your team to increase the quantity limit in a single trade by API, which is currently at 1800 for Nifty and 1200 for Banknifty options?
  • SRIJAN
    SRIJAN edited March 2022
    About this error happening, what's the error code you are getting? That would tell the issue.
    About quantity freeze, this isn't possible,as these quantity freeze limits are decided by the exchange,not the broker. To tackle this,just use a for loop if you want to take position for quantity more than quantity freeze.
  • DD1365
    Yes @SRIJAN currently I am doing the same as you have suggested, just wanted to know if we can get the freeze limit increased, thanks anyways..
  • rakeshr
    just wanted to know if we can get the freeze limit increased
    No, it's being set by the exchange as @SRIJAN mentioned above. You can check all the freeze limits here.
    You need to break net qty into multiple lesser than freeze qty orders.
  • DD1365
    Sure, I got it..thanks @rakeshr
This discussion has been closed.