Minute Backtest Routine for Liquidating All Positions
Summary
The post describes a short routine for closing all positions in a minute-based backtest. Its stated setup is to remove the existing strategy, run the routine in the minute backtest environment, and bind the original capital account. The routine records a message, copies the account’s current positions, then submits a target allocation of zero for each stock. This is a simple example of iterating over held assets and issuing liquidation orders through a trading platform’s strategy interface.
The post provides code but no backtest results, order-fill details, or discussion of how the platform handles unavailable, suspended, or partially filled positions. It also does not explain whether the routine is suitable for live trading or how the account binding affects execution. Treat it as a narrow example of position-closing mechanics, and check the platform’s order semantics and environment before adapting it.
Key ideas
- The routine copies the account’s current positions before iterating over them.
- It submits a zero target allocation for each held stock.
- The post frames the routine for a minute-based backtest environment using the original capital account.
- No execution results or handling of failed and partial orders are provided.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.