[GAP-045/GAP-046]: risk envelope guards complete

- BasicRiskManager.cs: add sized per-position risk validation and startup validator

- NT8StrategyBase.cs: fail fast on incoherent risk config and validate after sizing

- BasicRiskManagerTests.cs: cover assertions, sized risk, property sweep, MNQ tables

- docs/00-governance: record validation evidence and NQ SIM follow-up

Build: clean | Tests: 535 passing; Core 446 passing | Deploy: backup 20260823_144817
This commit is contained in:
2026-08-23 14:50:02 -04:00
parent 6658d2d120
commit d652e29959
8 changed files with 382 additions and 35 deletions

View File

@@ -82,8 +82,8 @@ Kilocode implemented Option 0: removed the `OnBarUpdate()` `SetStopLoss` call on
**Play 6 — Validate GAP-054 before any live exposure. STILL PENDING — this is the next actual step.**
NinjaTrader needs to be reopened for a manual NinjaScript compile, then a SIM trade run reaching +25 ticks or more, confirming no `BREAKEVEN runner stop ->` line appears and the runner's exit is materially better than entry + 1 tick (a trail stop in the execution grid, not a fixed stop), and that the scaler leg's target behavior is unchanged. Only after this passes is GAP-054 done and RUNNER-001 unblocked.
**Play 7 — Risk guards, all three parts (DEC-19a/19b accepted).**
Hand `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md` to Kilocode in full — Part 3 is now written as directly actionable: implement the Tier 1 check reordering (post-sizing, `Qty`-aware) and confirm MNQ is present and correctly valued in both `GetTickValue` tables (GAP-052) as prep for the later cutover. **Do this on the current NQ configuration — do not switch the traded instrument as part of this task.** That's Play 11.
**Play 7 — Risk guards, all three parts (DEC-19a/19b accepted). IMPLEMENTED 2026-08-23, manual NQ SIM validation pending.**
`TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md` now fails startup for incoherent risk-envelope pairs, confirms MNQ is already `$0.50` in both hardcoded tick-value tables, and moves the live NT8 per-position `MaxTradeRisk` check to after sizing so `StopTicks * TickValue * Qty <= MaxTradeRisk` is enforced. Build/tests/deploy passed with backup `20260823_144817`. Remaining validation: manual NT8 compile, NQ SIM guard checks, and high-ATR signal behavior. The MNQ cutover is still Play 11 and was not started.
**Play 8 — MaxDailyTrades persistence (DEC-21 accepted). IMPLEMENTED 2026-08-23, manual SIM restart validation pending.**
`TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md` now persists `{trading_date, daily_trade_count, account, strategy_name, symbol}` to `daily_trade_count_<AccountName>_<StrategyName>.json`, rehydrates same-date count, resets and overwrites on a new trading date, and skips file I/O when `Account == null`. Automated tests cover same-date restore, new-date reset, corrupt file, backtest no-I/O, and the 2026-08-16 19:12 / 2026-08-17 11:04 same-CME-date scenario. Remaining validation: manual NT8 compile plus SIM restart test confirming the next same-day signal rejects with `REJECT: reason=MaxDailyTrades`.
@@ -116,7 +116,7 @@ This is a separate, later step — not part of today's six tasks. Once GAP-054,
- [x] GAP-047 Part 1/2: study delivered, DEC-20260823-01 accepted, runtime designed weights implemented and tested
- [ ] GAP-054 runner trail: implemented, validated on sim/replay before any live gate run
- [x] GAP-055 persistence: implemented and automated restart/rollover-boundary tests passed; manual SIM restart validation pending
- [ ] GAP-045/046 all three parts: implemented on NQ, including the post-sizing Tier 1 reorder and the MNQ tick-table check
- [x] GAP-045/046 all three parts: implemented on NQ, including the post-sizing Tier 1 reorder and the MNQ tick-table check; manual NQ SIM validation pending
- [ ] GAP-049 telemetry: implemented, -523.25 anomaly re-checked and resolved
- [ ] `git status --short` re-checked: confirm exactly the files each TASK prompt's DO list authorized, nothing else
- [ ] SPRINT_BOARD.md, active_work.md, decisions.md all reflect end-of-day state