websocket on_order_update addition gives me error 500

pawan12
pawan12 edited January 5 in Python client
yesterday i added on_order_update callback in my existing to just print order_updates. as soon as i placed few orders websocket got disconnected and i got this error and none of the order updates were printed. after few seconds it reconnected back and its been in connected state for more than half an hour since than. does anyone else also faced this ? P.S i run socket with threaded=True

  • pawan12
    @sujith do share some insights if i am missing anything ?
  • tonystark
    If you are experiencing random websocket disconnections that means the internet connection is not stable.

    Where did you see this 500 error? Please enable debug mode in the ticker class to see more logs. Post the error logs here.
  • pawan12
    see i saw the disconnection in all accounts at the same time when i placed a bunch of orders. ignore error 500 thats some other issue i figured out. As autoreconnct was enabled after few seconds it reconnected and since than all worked perfectly.
  • tonystark
    Could you tell me the exact timestamp this occurred? I will check with backend team
  • pawan12
    9.20.02
  • tonystark
    I checked with the team and can confirm that there was no events during that period.

    Are all accounts using the same internet connection or ISP? If yes then it can still be an internet stability issue. And your code will have to account for these disruptions. You could fetch the order book after every ticker reconnect to reconcile the missing updates.
  • pawan12
    @tonystark i am 100% sure there is a issue with websocket on_order_ callback. today 4 terminals all running zerodha api in 3 terminals no disconnection reason no order yet triggered in those account. 4th terminal frequent disconnection coz i am firing orders in that.
  • tonystark
    What exactly happens in on_order_ callback? If it is an expensive operation it might cause issues to ticker. Could you post the code snippet in that callback?

    Could you enable debug logs and paste here the parts where the disconnect/reconnect happened?
  • pawan12
    ok so basically i am calling a telegram api to send me msgs. let me do one thing let me just remove my entire code from on_order_ callback and just print. if that works i will do these expensive operation out of call back.
  • pawan12
    @tonystark hey thanks for ur reply and i confirm once i removed the expensive operation from the callback everything is working fine
Sign In or Register to comment.