Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (429 -

I have started to try out 50+ strategies in parallel to test if Zerodha can be relied on for a serious trading business. Zerodha support seems to be run by AI-bots, thereby forced to raise my concerns here in Public.

Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (429 - TooManyRequests))

I use pykiteconnect library ( KiteConnect: 3.9.0 ) to interact with Zerodha backend systems. I tried my experiment for 2-days, Yesterday It ran smoothly for around 48-strategies in parallel, but today it randomly started to throw the above bug for ~36 parallel strategies. I have no further information whatsoever on why & how of '429'. Request you to have a look at logs from my account & share the underlying problematic thing causing this error.

I am confident of having written a perfectly efficient-code that does not send unnecessary-requests for orders & historical-data. For 'quote' data, I only use Websocket-via the above pykiteconnect Library.

I need reliable systems to run my trade practice, please help me. I can't trust Zerodha systems if errors happen randomly or if there is no-one even willing to help with logs/basic-details to understand underlying issues of code written by Zerodha-Team.
  • rakeshr
    Our kiteconnect system is reliable and used by 1000s of developers, including a lot of start-ups.
    429 - TooManyRequests
    This error occurred because of being rate-limited, exceeding the rate limits mentioned. This thread also explains in detail the rate-limits logic.
  • msh
    I have built production apps in the past with atleast-as-much-traffic as Zerodha atleast on the Order handling front.

    I can be 101% sure that it's not even remotely possible that any limits other than quote-api will even reach 10% of the limits. I just-don't understand this 'quote-api' rate-limits. I don't use Kite-APIs directly, I simply use your 'pykiteconnect library', using it only it only-as-much-as-needed. The only possible 429-reason that I can fathom is some internal-pykiteconnect code that might be structured differently & calling backend-too-often.

    I cannot obviously, ask for access to internal Zerodha-code & thereby asked incase you have access to my-logs that could help resolve the issue faster.

    Irrespective of number of people using these systems, if most folks are not running so-many-strategies. I would still consider the system( both the code & support ) unreliable for serious-business,, given that sorting out such a small-issue is becoming impossible even though the issue is clearly pykiteconnect-code/zerodha-backend-code/rate-limiting.

  • msh
    And I seriously hope that pykiteconnect library folks know about the changes happening on Zerodha-backend-code & it's impact on them.
  • msh
    msh edited November 2023
    I did a detailed check on this today [ on pykiteconnect ]

    I enabled kite-ticker's on_error & enabled debug in Kite-Trading-Session-Generator.
    There is no detailed debugging result for me to view. The only information is
    "'ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (429 - TooManyRequests))"
    which gets generated on pykiteconnect by-it's-own trying to connect to Zerodha-backend.

    Let me know, how can any normal-human-being sort this issue?
  • sujith
    Each Kite Connect app can only create only 3 Websocket connections. Maybe you are exceeding that. You can check out FAQs to know more about the rate limits.

    PS: Kite Connect is purely an execution platform. We don't provide support or solution for writing strategies.
    You can always ping on the forum and the community members are happy to help. We are all full time developers like you who work on our own projects and take out some time to help and grow the community.
    Passive aggressive comments will not lead anything.
Sign In or Register to comment.