[GAP-055]: MaxDailyTrades persistence complete
- SimpleORBStrategy.cs: persist and rehydrate daily trade count by trading date - NT8StrategyBase.cs: pass live account/log metadata for persistence - SimpleORBNT8.cs: seed persistence metadata in strategy config - MaxDailyTradesTests.cs: cover restore, reset, corrupt file, backtest no-I/O, CME date - docs/00-governance: record validation evidence and manual SIM follow-up Build: clean | Tests: 521 passing; Core 432 passing | Deploy: backup 20260823_143311
This commit is contained in:
@@ -85,8 +85,8 @@ NinjaTrader needs to be reopened for a manual NinjaScript compile, then a SIM tr
|
||||
**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 8 — MaxDailyTrades persistence (DEC-21 accepted).**
|
||||
Hand `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md` to Kilocode. Validate with a manual restart test spanning a simulated 18:00 ET rollover boundary — confirm the count persists across a restart within the same trading day and resets across the boundary.
|
||||
**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`.
|
||||
|
||||
**Play 9 — GAP-049 telemetry direction fix.**
|
||||
No decision gate — this is dashboard/telemetry accuracy only. Hand `TASK_GAP049_TELEMETRY_DIRECTION_PROMPT.md` to Kilocode any time today. Validate by re-checking the implausible -523.25 point gap value the task flags; confirm it resolves to a sane number after the fix.
|
||||
@@ -115,7 +115,7 @@ This is a separate, later step — not part of today's six tasks. Once GAP-054,
|
||||
- [x] GAP-048 taxonomy: implemented, tested, SPRINT_BOARD updated; manual NT8/dashboard spot-check pending
|
||||
- [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
|
||||
- [ ] GAP-055 persistence: implemented, restart/rollover-boundary test passed
|
||||
- [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
|
||||
- [ ] 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
|
||||
|
||||
@@ -15,7 +15,7 @@ Full detail: `docs/NT8_SDK_Master_Document_v7.0_Complete.docx`.
|
||||
| 1 | **GAP-046** — set `AccountStartingBalance` or disable `EnableTrailingDrawdown` | operator action, no code | Operator | Every entry, from 14:30 ET daily |
|
||||
| 2 | **GAP-045/046 guards** — resolved: MNQ (cutover staged separately) + per-position semantics | `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md` (Part 3 now actionable) | Kilocode, on current NQ config | All high-ATR days |
|
||||
| 3 | **GAP-048** — split the reject taxonomy | `TASK_GAP048_REJECT_TAXONOMY_PROMPT.md` — implemented/deployed 2026-08-23, backup `20260823_142014` | Kilocode | Manual NT8 compile and dashboard spot-check |
|
||||
| 4 | **GAP-055** — persist `MaxDailyTrades` across restarts | `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md` | Kilocode | Gate Run #3 sample integrity |
|
||||
| 4 | **GAP-055** — persist `MaxDailyTrades` across restarts | `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md` — implemented/deployed 2026-08-23, backup `20260823_143311` | Kilocode | Manual NT8 compile and SIM restart validation |
|
||||
| 5 | **GAP-047** — Part 1 complete (commit `cbf45df`), Part 2 runtime weight fix implemented 2026-08-23 | `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md` — verification passed, deploy backup `20260823_135331` | Kilocode | Fresh gate freeze needed before gate evidence |
|
||||
| 6 | **GAP-054** — auto-breakeven destroys the runner trail | `TASK_GAP054_RUNNER_TRAIL_PROMPT.md` — **Option 0 implemented + source-verified 2026-08-21, NOT yet SIM-validated, NOT committed** | Kilocode implemented; operator validates | **RUNNER-001**, still blocked until SIM/replay validation passes |
|
||||
| 7 | **GAP-049** — telemetry `STATE:` score is direction-incorrect | `TASK_GAP049_TELEMETRY_DIRECTION_PROMPT.md` | Kilocode | Dashboard trustworthiness; degrades item 5 |
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# Current Status — NT8 SDK
|
||||
**Last Updated:** 2026-08-23 (GAP-048 reject taxonomy implemented and deployed)
|
||||
**Last Updated:** 2026-08-23 (GAP-055 MaxDailyTrades persistence implemented and deployed)
|
||||
|
||||
---
|
||||
|
||||
## 2026-08-23 — GAP-055 IMPLEMENTED, manual NT8/SIM restart validation pending
|
||||
|
||||
Kilocode executed `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md`. `MaxDailyTrades` now persists across live/SIM strategy restarts by writing `{LogDirectory}\daily_trade_count_<AccountName>_<StrategyName>.json` after each daily-count increment and rehydrating once per trading date on the first realtime-eligible bar after session reset.
|
||||
|
||||
Implementation notes:
|
||||
- Persistence is opt-in from the NT8 adapter and enabled only when `Account != null`.
|
||||
- Strategy Analyzer/backtest paths with `Account == null` do not read or write the file.
|
||||
- Trading date follows the adapter/session date already used by `BuildSessionInfo()` / `MarketSession.SessionStart`, so the 2026-08-16 19:12 ET and 2026-08-17 11:04 ET sessions both resolve to trading date 2026-08-17.
|
||||
- Missing/corrupt/unreadable files start at zero, log a warning, and do not throw.
|
||||
- File key is account + strategy name as specified; `symbol` is stored in the payload, and multiple same-account/same-strategy instances share the same counter by design for this task.
|
||||
|
||||
Evidence:
|
||||
- Added tests for same-date restore, new-date reset/overwrite, corrupt-file warning/no throw, `Account == null` no-read/no-write behavior, and the 2026-08-16 evening / 2026-08-17 morning same-CME-date scenario.
|
||||
- `verify-build.bat`: passed, 521/521 tests.
|
||||
- `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal`: passed, 432/432.
|
||||
- `deployment\deploy-to-nt8.bat`: completed; backup `deployment\backups\20260823_143311`; `NinjaTrader.Custom.dll` was not present to invalidate.
|
||||
|
||||
Next required action: manual NinjaScript compile after starting NinjaTrader, then SIM validation by taking one trade, stopping/restarting the strategy on the same trading day, and confirming the next signal is rejected with `REJECT: reason=MaxDailyTrades`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -60,7 +60,9 @@ Use this file to record durable project decisions that affect implementation pat
|
||||
- **Decision:** Persist `{trading_date, daily_trade_count, account, strategy_name, symbol}` to `{LogDirectory}/daily_trade_count_<AccountName>_<StrategyName>.json` on each increment, and rehydrate at `State.Realtime` entry when the persisted trading date matches. Reuse the persistence pattern already established for the Conservative trailing-drawdown halt file (DEC-20260818-17) rather than inventing a second mechanism. Align the trading-date boundary with the CME session rollover (18:00 ET) rather than the calendar date, using `SessionManager` or NT8's own session date if either already exposes it. Strategy Analyzer/backtest (`Account == null`) must neither read nor write the file so backtest behaviour is byte-for-byte unchanged.
|
||||
- **Consequences:** Gate discipline explicitly contemplates restarts (recompiles, workspace changes, connection recovery), so without this a gate run under `MaxDailyTrades=1` cannot guarantee its own cap and its sample is uninterpretable in the same way the previous two were. Adds a small file-I/O dependency to the realtime path; a missing or corrupt file must degrade to count-zero plus a WARNING, never an exception.
|
||||
- **Related Files:** `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md`, `docs/00-governance/decisions.md`
|
||||
- **Action Required:** Accepted. Execute `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md`; then verify by taking one SIM trade, restarting the strategy the same trading day, and confirming the next signal is rejected with `REJECT: reason=MaxDailyTrades`.
|
||||
- **Implementation Note (2026-08-23):** Implemented as opt-in live/SIM persistence from the adapter into `SimpleORBStrategy`. `NT8StrategyBase` enables persistence only when `Account != null`, passes account/name/resolved log directory metadata at `State.Realtime`, and also includes the metadata on realtime contexts. `SimpleORBNT8` seeds the same metadata into the shared `StrategyConfig`. `SimpleORBStrategy` rehydrates once per trading date on the first realtime-eligible bar after session reset, restores when the file date matches, resets and overwrites when the date differs, writes after every daily-count increment, and logs either `DAILY_TRADE_COUNT restored: date=<yyyy-MM-dd> count=<n> max=<n>` or `DAILY_TRADE_COUNT reset: new trading date <yyyy-MM-dd>`. Missing/corrupt/unreadable files degrade to count zero plus `DAILY_TRADE_COUNT warning...` without throwing. Trading date follows the adapter/session date already used by `BuildSessionInfo()`/`MarketSession.SessionStart`, so 2026-08-16 19:12 ET and 2026-08-17 11:04 ET both resolve to trading date 2026-08-17. Backtest/Strategy Analyzer contexts with `Account == null` do not read or write state even if persistence parameters are present. The file key is exactly the approved `{AccountName}_{StrategyName}` path; `symbol` is recorded in the payload, but multiple same-account/same-strategy instances intentionally share the counter and distinct per-instance keys remain out of scope.
|
||||
- **Verification (2026-08-23):** Added tests for same-date restore, new-date reset/overwrite, corrupt-file warning/no throw, `Account == null` no-read/no-write behavior, and the 2026-08-16 19:12 / 2026-08-17 11:04 same-CME-date restart scenario. `verify-build.bat` passed 521/521 tests (432 Core, 79 Integration, 10 Performance); `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 432/432; `deployment\deploy-to-nt8.bat` completed with backup `20260823_143311` and noted `NinjaTrader.Custom.dll` was not present to invalidate.
|
||||
- **Action Required:** Manually compile in NinjaTrader, then validate in SIM by taking one trade, stopping/restarting the strategy on the same trading day, and confirming the next signal is rejected with `REJECT: reason=MaxDailyTrades`.
|
||||
|
||||
### DEC-20260818-20
|
||||
- **ID:** DEC-20260818-20
|
||||
|
||||
Reference in New Issue
Block a user