fix: grandfather pre-cutover stop episodes

This commit is contained in:
2026-07-17 20:28:42 +02:00
parent d858475ddb
commit d13c54e3c7
5 changed files with 179 additions and 16 deletions
+8
View File
@@ -18,6 +18,14 @@ Scanner errors do not count as a gate failure. The two transitions are persisted
on the latest initial-stop `PaperTrade`, so neither a service call nor a restart
can bypass the rule.
Migration 022 applies the policy prospectively. Existing initial-stop rows are
grandfathered by marking both reset timestamps complete at their historical
`closed_at`; otherwise their new NULL columns would be mistaken for active
locks despite no scanner observations having existed. At runtime, only the
actual latest closed trade per ticker can start a lock, and only when that exit
was an initial stop. A newer trailing, time, target, or manual exit therefore
cannot revive an older stop episode.
This replaces the previously proposed fixed five-session lockdown. The normal
reset counts an unqualified stop-day close when that close is observed after the
stop. The stricter experiment, which required a failed close on a later session,