Sprint 3: Production Hardening — 9 tasks completed

## Summary
Implemented 9 production-hardening tasks across risk, execution, calendar, and governance.
All changes verified: build clean (0 errors), 492 tests passing (404 core + 78 integration + 10 perf).

## Core Changes

### Risk & Portfolio (3 tasks)
- **GAP-019** Portfolio Heat Tier 3.5: Added MaxHeatPct (default 3%) to AdvancedRiskConfig;
  ValidatePortfolioHeat() computes TotalOpenRisk + NewTradeRisk / Equity * 100; rejects when exceeded.
- **GAP-003** RiskPerTrade <= MaxTradeRisk Assertion: RiskPerTrade property in RiskConfig; throws
  ArgumentException at ValidateOrder() if RiskPerTrade > MaxTradeRisk; 3 unit tests.
- **GAP-005** GetRiskStatus() Live Config: _currentDailyLossLimit field updated from config.DailyLossLimit
  on each ValidateOrder(); GetRiskStatus() returns actual value; 3 unit tests.

### Execution & Position Management (3 tasks)
- **TASK-06a** Runner Mode Architecture: RunnerMode enum (Auto/Mode1DualLeg/Mode2RunnerOnly/
  Mode3ScalerOnly/Disabled); ResolveRunnerMode() logic; 4-mode SubmitOrderToNT8() behavior.
- **TASK-06b** ATR Dynamic Stop: EnableDynamicStop, AtrPeriod, AtrMultiplier, MinStopTicks, MaxStopTicks;
  computes dynStop = clamp(round(ATR/TickSize * Mult), Min, Max); overrides intent.StopTicks.
- **GAP-006** Position-Close Re-arm: OnPositionUpdate() sends clear_trade_taken when flat;
  EnableBarBasedRearm parameter gates legacy bar-driven re-arm (default false for live).

### Strategy Intelligence (2 tasks)
- **GAP-004** orbRangeTicks Fix: DailyBarContext.OrbRangeTicks field; computed from actual ORB
  high/low / TickSize; passed to Factor 7 (ORBvsATR).
- **GAP-010** Short-Side Regime Filter: EnableShortTrendFilter param; vetoes shorts when
  AVWAP slope > 0 (bullish); configurable, default true.

### Calendar & Trailing (2 tasks)
- **GAP-008** CME Holiday Awareness: NEW CmeHolidayCalendar.cs with 9 observed holidays +
  Good Friday (Easter calc); EnableCMEHolidayGuard skips ORB window on holidays.
- **GAP-009** ATR Trailing Real ATR: EnableATRTrailing, ATRTrailingPeriod (14), ATRTrailingMultiplier (2.0),
  ATRTrailingMinTicks (8), ATRTrailingMaxTicks (60); computes trailTicks from ATR(Close,Period)[0].

## Governance
- SPRINT_BOARD.md, current_status.md, decisions.md (DEC-20260711-01 through -09), NEXT_PROMPT.md updated
- All 9 tasks moved ACTIVE -> COMPLETED; GAP-011 (Gitea CI) now ACTIVE

## Verification
- verify-build.bat: 0 errors, 0 warnings
- Tests: 492 passing (404 core + 78 integration + 10 performance)

## Files
- Modified: 13 source, 3 test, 9 governance
- Deleted: 28 obsolete spec/docs
- Added: 1 new module (NT8.Core.Calendar), governance files
- Dual-deployed to NT8 Custom\Strategies\

## Rollback
Tag: sprint3-production-hardening-complete
To revert: git reset --hard sprint3-production-hardening-complete
This commit is contained in:
2026-07-13 08:38:25 -04:00
parent 99e993bee6
commit c9041df36a
64 changed files with 3338 additions and 825 deletions

View File

@@ -1,20 +1,37 @@
# Executive Summary
**Last Updated:** 2026-05-04 (Sprint 3 reboot)
**Master Reference:** `NT8_SDK_Master_Document_v6_Final.docx` — 22 sections + Appendices A–F
## Scope
- This folder (`docs/00-governance/`) is the canonical governance source for project state, priorities, architecture intent, and active execution guidance.
- Governance is aligned to Sprint 2 (SIM validation) with production hardening gaps tracked and prioritized.
## What This System Is
NT8-SDK is an institutional-grade algorithmic futures trading platform for NinjaTrader 8.
9-layer architecture: Signal → Intelligence (10-factor confluence) → Risk (Tiers 1–3.5 + Portfolio Heat)
→ Sizing → OMS → Execution → Analytics → Market Data → NT8 Adapter Ring.
Flagship strategy: SimpleORBNT8 — 30-min ORB, NQ primary, 3-mode runner architecture.
## Current Position (2026-04-05)
- Core engine is implemented with 240+ passing tests across core components.
- NT8 execution path is wired and validated in SIM for baseline operation.
- Remaining work is focused on closing operational hardening gaps and validating runner behavior under production-like conditions.
## Confirmed Working (verified against live repo)
- End-to-end pipeline: signal → risk → sizing → NT8 managed execution ✅
- Kill switch (EnableKillSwitch), verbose logging (EnableVerboseLogging) ✅
- Connection loss detection (OnConnectionStatusUpdate) ✅
- ExecutionCircuitBreaker — fully wired in NT8StrategyBase ✅
- NT8 order execution — EnterLongManaged/EnterShortManaged with correct SetStopLoss ordering ✅
- 240+ tests passing across NT8.Core.Tests, NT8.Integration.Tests, NT8.Performance.Tests ✅
## Critical Open Issues (Sprint 3 Must-Fix)
- **ARCH DEFECT:** Runner leg never fires at responsible risk settings (useRunner = Qty≥2 gate is wrong)
→ Fix: Runner Mode enum with Auto/Mode1DualLeg/Mode2RunnerOnly/Mode3ScalerOnly — TASK-06a
- **ARCH DEFECT:** Fixed 8-tick stop ignores market volatility — stop-outs before moves develop
→ Fix: ATR-based dynamic stop (EnableDynamicStop, AtrPeriod, AtrMultiplier) — TASK-06b
- **RISK GAP:** No Portfolio Heat (Tier 3.5) — aggregate open risk % not enforced — GAP-019
- **RISK GAP:** RiskPerTrade can silently exceed MaxTradeRisk — no startup assertion — GAP-003
## Approved Direction
- Keep execution in managed-order NT8 patterns and C# 5.0 / .NET Framework 4.8 constraints.
- Complete critical and high-priority hardening tasks before expanding strategy scope.
- Treat historical handover artifacts as context only; governance decisions flow from this folder.
- No feature expansion until Sprint 2 SIM gate is met: PF > 2.0, MaxDD < $500, 2+ week run
- Sprint 3 is production hardening — all CRITICAL/HIGH gaps from Section 7 of master doc
- C# 5.0 / .NET 4.8 / NT8 managed orders — no exceptions
- Dual-deploy rule: every strategy file change goes to BOTH src/ AND NT8 Custom/Strategies/
## Immediate Priorities
- Confirm runner-leg dual-fill behavior in analyzer/session logs.
- Close safety and observability items already identified in Sprint 2/3 gap tracking.
- Maintain strict file-boundary and compile-guardrail discipline for all changes.
## Execution Workflow
1. Kilocode executes tasks from SPRINT_BOARD.md in order
2. After each task: updates SPRINT_BOARD.md, writes learnings, stages NEXT_PROMPT.md, commits
3. Claude reviews state when a sprint series completes and plans the next workset
4. Master doc (v6 Final) is the authoritative spec for all architecture and implementation details