Getting errors in kite.positions()

AAAAAAAAAA
Hello, My code usually works fine. But sometimes, kite.positions() throws an error message that causes the entire algo to stop. I will paste the error code below for reference. My question is :
Could I just do this?
while True:
try:
pos = kite.positions
break
except:
pass

Would that this method deal with the error properly?

OR is there some other method? Please note, I call this method multiple times in my code, so would I have to do this everythere kite.positions() is present?

The error:



Thank you!
  • rakeshr
    Are you calling kite.positions() inside WebSocket code?
    If yes, then it's strictly not recommended. Polling of kite.positions() is not recommended. You will have to do this alternatively, this thread explains more.
  • AAAAAAAAAA
    AAAAAAAAAA edited September 2021
    Hello @rakeshr, the linked thread does not address my concerns.

    I call kite.positions() outside the websocket code. I have also gotten the same error messages there as well. I dealt with them using the while-try-except method and it has handled the exception. As you can see, the error clearly eminaetes due to certain low-level codes.

    I hoped that by asking here, someone would guide me as to why this error props up and whether there is any better way of handling this error, rather than the while-try-except method. Thanks!

    PS - what do you mean by "polling" of a function? Thanks
Sign In or Register to comment.