chore: checkpoint contaminated Gate 2 findings
This commit is contained in:
86
TASK_00a_PROMPT.md
Normal file
86
TASK_00a_PROMPT.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# TASK-00a — Provenance Controls (Sprint 2.6)
|
||||
**Spec:** NT8_SDK_Master_Document_v6.1 — Section 3.1
|
||||
**Depends on:** TASK-FIX-01 (HEAD must compile)
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Read docs/00-governance/active_work.md and SPRINT_BOARD.md before starting.
|
||||
|
||||
Implement TASK-00a: Provenance Controls — export full strategy configuration + runtime parameters on every session start and every trade, so Gate Run #2 trades are 100% reproducible from exported artifacts alone.
|
||||
|
||||
WHAT TO BUILD:
|
||||
|
||||
1. In NT8StrategyBase.cs (src/NT8.Adapters/Strategies/NT8StrategyBase.cs):
|
||||
a. Add method: protected virtual void WriteSessionProvenance()
|
||||
- Called at end of State.SetDefaults and on State.Realtime transition
|
||||
- Exports to: <LogDirectory>/provenance_<StrategyName>_<yyyyMMdd_HHmmss>.json
|
||||
- JSON structure:
|
||||
{
|
||||
"session_id": "<guid>",
|
||||
"strategy_name": "<Name>",
|
||||
"timestamp_utc": "<ISO8601>",
|
||||
"nt8_version": "<NinjaTrader.Core.Globals.Version>",
|
||||
"sdk_version": "6.1",
|
||||
"config_hash": "<SHA256 of all [NinjaScriptProperty] values>",
|
||||
"ninjascript_properties": { <all [NinjaScriptProperty] name:value pairs> },
|
||||
"sdk_parameters": { <all _strategyConfig.Parameters entries> },
|
||||
"july_11_params": {
|
||||
"RunnerActivationMode": "<enum value>",
|
||||
"EnableDynamicStop": <bool>,
|
||||
"AtrMultiplier": <double>,
|
||||
"EnableShortTrendFilter": <bool>,
|
||||
"EnableATRTrailing": <bool>,
|
||||
"ATRTrailingMultiplier": <double>,
|
||||
"EnableCMEHolidayGuard": <bool>,
|
||||
"EnableBarBasedRearm": <bool>
|
||||
},
|
||||
"test_mode_banner": "<TEST MODE ACTIVE>" or "<LIVE MODE>"
|
||||
}
|
||||
- C# 5.0: use StringBuilder, no $\"\", no ?. operator
|
||||
|
||||
b. Add method: protected virtual void WriteTradeProvenance(StrategyIntent intent, double atrStopTicks)
|
||||
- Called in SubmitOrderToNT8 after intent is fully resolved
|
||||
- Appends to: <LogDirectory>/trades_<StrategyName>_<yyyyMMdd>.jsonl (JSON Lines)
|
||||
- Each line:
|
||||
{
|
||||
"session_id": "<same guid as session provenance>",
|
||||
"trade_seq": <int, increments per session>,
|
||||
"timestamp_utc": "<ISO8601>",
|
||||
"symbol": "<intent.Symbol>",
|
||||
"side": "<Buy/Sell>",
|
||||
"quantity": <int>,
|
||||
"stop_ticks": <int>,
|
||||
"target_ticks": <int>,
|
||||
"atr_stop_ticks": <int or null>,
|
||||
"resolved_runner_mode": "<Mode1DualLeg/Mode2RunnerOnly/Mode3ScalerOnly/Disabled>",
|
||||
"confluence_grade": "<A+/A/B/C/D/F>",
|
||||
"confluence_score": <double>,
|
||||
"risk_mode": "<Normal/Reduced/Halt>",
|
||||
"daily_pnl_at_entry": <double>
|
||||
}
|
||||
|
||||
2. In SimpleORBNT8.cs (src/NT8.Adapters/Strategies/SimpleORBNT8.cs):
|
||||
- Override WriteSessionProvenance() to include ORB-specific params:
|
||||
OpeningRangeMinutes, StdDevMultiplier, StopTicks, TargetTicks, MinTradeGrade, MaxDailyTrades, TestMode
|
||||
|
||||
3. In SimpleORBStrategy.cs (src/NT8.Strategies/Examples/SimpleORBStrategy.cs):
|
||||
- Add public string GetProvenanceSnapshot() returning JSON of _tradeTaken, _dailyTradeCount, _openingRangeHigh/Low, _currentSessionDate, regime state
|
||||
|
||||
4. Add [NinjaScriptProperty] string LogDirectory (default = @"C:\NT8Logs\Provenance") to NT8StrategyBase
|
||||
- Ensure directory exists on first write
|
||||
|
||||
CONSTRAINTS:
|
||||
- C# 5.0 only: StringBuilder, no string interpolation, no ?. or ??, no =>, no var fields, no pattern matching
|
||||
- Use System.Security.Cryptography.SHA256 for config_hash
|
||||
- Newtonsoft.Json already available (NT8 dependency)
|
||||
- Dual-deploy ALL changed files to C:\Users\billy\Documents\NinjaTrader 8\bin\Custom\Strategies\
|
||||
|
||||
VERIFICATION:
|
||||
- .\verify-build.bat ✅
|
||||
- dotnet test ✅ (492 tests)
|
||||
- Enable strategy in NT8 SIM → verify provenance_*.json and trades_*.jsonl created with correct structure
|
||||
- Verify July 11 params appear in provenance with actual runtime values
|
||||
|
||||
WHEN DONE: Follow .kilocode/rules/self_learning_loop.md completely (all 6 steps).
|
||||
```
|
||||
Reference in New Issue
Block a user