Strategy Trading Error

Brian - one of my strategies is receiving order errors, the other strategies are executing successfully. Yesterday, I noticed in the logs that one of the strategies never "completed trading". Then today I received the below error message for that same strategy:

2025-05-22 09:34:04 quantrocket.countdown: ERROR Error running /opt/conda/bin/quantrocket zipline trade Live_Strategy_Three_No_Hedge
2025-05-22 09:34:04 quantrocket.countdown: ERROR msg: Live_Strategy_Three_No_Hedge is already trading in account XXXXXXX
2025-05-22 09:34:04 quantrocket.countdown: ERROR status: error

Should I cancel the instructions / orders from the day that the strategy never completed trading? If yes, do you have a script I can run to do that?

Please advise.

Thanks.

I would cancel the strategy so the next run can proceed, and I would review the detailed logs to see if the strategy unexpectedly died or perhaps hung at some point. If your strategy submits Day orders, they will have already completed by this point. I would review the blotter positions to make sure everything looks satisfactory.

@Brian I was able top successfully close all of the positions in the strategy where I had the issues. Do I need to do anything else to "cancel the strategy" or should I now just wait to see if it successfully completes orders at the next Rebalance? Thank you.

There is a API function to cancel strategies: API Reference

Alternatively you can force-recreate the zipline container to clear everything out.

Got it. Thank you.

@Brian simple question.....after I close the positions and cancel the strategy if I want to restart it do I just add it back into my cron schedule? Thanks.

Yes, adding an entry on the crontab will cause the strategy to run. I would run quantrocket blotter positions --order-refs 'my-strategy' first and make sure the blotter agrees the strategy is flat. It should as long as you closed the positions through the blotter, not outside of it.

1 Like