Persisting Trade Lots to Sell Positions by Holding Period
Summary
This short exchange addresses how to sell stock shares according to the age of each entry. The example strategy opens separate lots in the same stock on consecutive days, then intends to close each lot after a specified holding period. That requires tracking entry dates and quantities separately; selling the entire symbol position would not preserve the desired lot-by-lot schedule.
The proposed implementation hint is to store this tracking data in the context’s extension field, rather than an ordinary context member that the user found was reinitialized during simulated trading. The exchange offers no complete data structure, sample logic, or details about how persistence behaves across restarts or live deployments. It is a narrow state-management suggestion, so traders would still need to handle partial fills, missing state, and the platform’s trading-day conventions in their implementation.
Key ideas
- A holding-period exit needs to track entry dates and quantities for each position lot.
- Separate entries in the same stock may need to be sold on different days.
- The reply recommends storing persistent strategy state in the context extension field.
- The exchange does not provide complete implementation details or address restart and fill edge cases.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.