[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

@@ -1,5 +1,28 @@
# Current Status — NT8 SDK
**Last Updated:** 2026-08-23 (GAP-055 MaxDailyTrades persistence implemented and deployed)
**Last Updated:** 2026-08-23 (GAP-045/046 risk guards implemented and deployed)
---
## 2026-08-23 — GAP-045/046 IMPLEMENTED, manual NT8/NQ SIM validation pending
Kilocode executed `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md` Parts 1-3 on the current NQ configuration. The MNQ instrument cutover was not performed and remains a separate DEC-20260819-01 follow-on.
Implementation notes:
- Added startup risk-envelope assertions via `RiskEnvelopeValidator` and `NT8StrategyBase`.
- `EnableTrailingDrawdown=True` now requires `AccountStartingBalance>0` at startup.
- `MaxStopTicks * TickValue <= MaxTradeRisk`, `MinContracts>=1`, `MinContracts<=MaxContracts`, and `MaxTradeRisk<=DailyLossLimit` are enforced before runtime order flow.
- GAP-048 had already split the misconfigured trailing-drawdown reject reason to `TrailingDrawdownNotConfigured`; no duplicate taxonomy change was needed.
- Confirmed MNQ is present and valued at `$0.50` in both `BasicRiskManager` and `BasicPositionSizer` tick-value tables.
- Added quantity-aware per-position risk enforcement: the NT8 live path now sizes first, then validates `StopTicks * TickValue * Qty <= MaxTradeRisk` against the selected quantity.
- Existing `IRiskManager.ValidateOrder()` compatibility remains for older callers and validates one contract.
Evidence:
- Added tests for all startup assertions, quantity-aware Tier 1 rejection, the old pre-quantity pass / new two-contract reject case, bounded property-style range coverage, and MNQ tick table parity.
- `verify-build.bat`: passed, 535/535 tests.
- `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal`: passed, 446/446.
- `deployment\deploy-to-nt8.bat`: completed; backup `deployment\backups\20260823_144817`; `NinjaTrader.Custom.dll` was not present to invalidate.
Next required action: manual NinjaScript compile after starting NinjaTrader, then NQ SIM validation of startup guard failures and the quantity-aware per-position `MaxTradeRisk` behavior. Do not validate or execute the MNQ cutover as part of this task.
---