Initialize State and Date Handling in Daily Trading Jobs
Summary
The document describes a problem encountered when using an initialization module to set a day counter and prevent duplicate daily trades. In backtests, the counter reportedly advanced across several days, but in simulated trading the same first-day trade ran repeatedly, leaving later trading plans empty. The author asks whether initialization runs once at deployment or again each day, and how to maintain a counter across daily runs.
It also raises a scheduling edge case: a daily job intended for one trading date may start after midnight on the next calendar date. The post asks whether date checks should use the intended run date or the actual date at execution, especially when checking trading days and suppressing duplicates. It supplies no answers, implementation, or test results, so it identifies operational questions rather than establishing platform behavior or a recommended solution.
Key ideas
- A counter initialized inside a daily job may not persist as expected in simulated trading.
- The post reports a difference between backtest behavior and live simulation behavior.
- The author asks whether initialization runs at deployment or on each daily run.
- Delayed jobs can cross midnight, making calendar-date and trading-date checks ambiguous.
- The document poses these questions but provides no verified answers or implementation guidance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.