Issues while calling kite.positions(). Please help.

AAAAAAAAAA

I have used while-try-except loop to check whenever kite.positions() throws an error. I also log whenever it throws an error into a text file. The error is referenced here -> https://kite.trade/forum/discussion/10390/getting-errors-in-kite-positions#latest

So the code looks as follows:



I often see "caught exception in func" in my logfile as well as in the console, but the program continues to run without any issues.

Today however, after "caught exception in func" line was printed in the console, nothing happened for a couple hours. Only a single line was printed, both in the console and in the log file. The program did not proceed but was running.

Then "caught exception in func" was printed again in the console and appended in the log file.


It seems the program is stuck in the func. But I am confused. If the API is throwing an error continuously, shouldn't the line "caught exception in func" be printing non-stop in the console as well in the file, rather than only once a couple of hours?

As one would expect the program is not proceeding beyond func. I could tell because, I have coded my positions to be squared of by 3:28 pm along with a print message that says "positions squared". This has not printed and I am still retaining the positions.

I continued to get "caught exception in func" after market hours.

What do I do? Please help. Thank you very much!
  • sujith
    It is not recommended to poll positions. You need to fetch it and cache it. It changes only when there is a partial fill of an order or when order executes.
  • rakeshr
    while True:
    You are running a forever loop to fetch kite positions(nothing will proceed after this if a continuous exception is thrown ), which is strictly not recommended. If at all you need to re-fetch/pass(here) positions data(only after order changes), you should add a good amount of time delay.
    It seems the program is stuck in the func.
    As one would expect the program is not proceeding beyond func.
    Depends on how you call this func().
Sign In or Register to comment.