Hi Brian,
After making a manual trade yesterday while data was unavailable, I'm getting this error during my zipline live trading. It occurs right before before_trading_starts is executed, while zipline is syncing with the blotter:
quantrocket_zipline_1|replaying live order and transaction history for divStrat in account XXXXXXXX to bring Zipline's internal data structures up-to-date
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR Traceback (most recent call last):
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR File "sym://qrocket_log_py", line 34, in wrapped
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR File "sym://qrocket_qrzipline_trade_trade_py", line 57, in mule_trade_algo
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR File "sym://qrocket_qrzipline_trade_trade_py", line 179, in trade_algo
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR File "/opt/conda/lib/python3.8/site-packages/zipline/algorithm.py", line 652, in run
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR for perf in self.get_generator():
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR File "sym://qrocket_qrzipline_trade_algorithm_py", line 50, in get_generator
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR KeyError: '0:0'
quantrocket_flightlog_1|2021-07-15 06:17:08 quantrocket.zipline: ERROR
When I made the manual trades, I used the orderRef of the strategy name in IBKR TWS. Now they are showing up in executions with OrderId 0:0, which is causing the error.
I tried registering the manual trades with record_executions, but that just created additional execution entries. The entries with OrderId 0:0 are still there, and I'm not sure how to get rid of them.
My strategy can't load unless I wipe the slate clean by selling all positions and changing the strategy name (which I'd strongly prefer not to do). What else can I do?