Hi I encountered a live trading error but could not find the reason why..

I am having a scheduled code which runs every 2 minutes. Occasionally there will be a dictionary changed size runtime error. I checked inside the piece of code and is very sure there isn't such a case.

2021-07-15 14:52:02 LiveTradingRealTimeHandler.Run(): There was an error in a scheduled event EveryDay: Every 2 min. The error was RuntimeError : dictionary changed size during iteration
2021-07-15 14:52:03 Runtime Error: LiveTradingRealTimeHandler.Run(): There was an error in a scheduled event EveryDay: Every 2 min. The error was RuntimeError : dictionary changed size during iteration
2021-07-15 14:52:03 Runtime Error: LiveTradingRealTimeHandler.Run(): There was an error in a scheduled event EveryDay: Every 2 min. The error was RuntimeError : dictionary changed size during iteration: StackTrace: LiveTradingRealTimeHandler.Run(): There was an error in a scheduled event EveryDay: Every 2 min. The error was RuntimeError : dictionary changed size during iteration

I am suspecting that there are other scheduled codes which might have been changing the dictionary size while the piece of scheduled code is running. (I have a few scheduled tasks running at different time)

Is there anyway to get the line number or print out the dictionary that was affected? Or has anyone met into similar issues before. It happen intermittently and not during backtest. so likely some events triggered it.

 

 

 

Author