Files
nt8-sdk/TASK_GAP052_TICK_VALUE_CONSOLIDATION_PROMPT.md
mo 8b9a2e2b6a [GAP-052]: tick value table consolidation complete
- InstrumentTickValueTable.cs: add shared platform-neutral union tick-value table

- BasicRiskManager.cs and BasicPositionSizer.cs: delegate tick lookup and supported symbols to shared table

- AdvancedRiskManager.cs and AdvancedPositionSizer.cs: remove duplicate tick tables and delegate to shared table

- BasicRiskManagerTests.cs: prove risk/sizing table parity and 6A uses  tick value

- SPRINT_BOARD.md and decisions.md: record Option A, platform-neutrality rationale, and verification evidence

Build: clean | Tests: 552 passing; Core 463 passing | Dual-deployed: no - skipped per operator instruction
2026-08-25 10:50:27 -04:00

115 lines
5.6 KiB
Markdown

# TASK: GAP-052 — Two hardcoded tick-value tables have already drifted out of sync
# Staged: 2026-08-18 (v7.0 review, "raised, not yet prompted"), evidenced 2026-08-23/24
# Sprint: Stage 1 — real latent defect for 6E/6A, zero risk for currently-traded NQ/MNQ
# Owner: Kilocode
# ─────────────────────────────────────────────────────────────────
## THE DEFECT
Two independent, unsynchronized `private static double GetTickValue(string symbol)`
methods exist:
BasicRiskManager.cs ~178-191: ES, MES, NQ, MNQ, CL, GC (6 symbols) → default 12.50
BasicPositionSizer.cs ~155-170: ES, MES, NQ, MNQ, CL, GC, 6E, 6A (8 symbols) → default 12.50
This is not just a duplication risk flagged by the original review — **the
two tables have already drifted out of sync.** `BasicPositionSizer` lists
`6E` ($12.50/tick) and `6A` ($10.00/tick); `BasicRiskManager` does not list
either and falls through to `default: return 12.50`.
For `6E`, the default happens to match (12.50), so no live bug there today.
For **`6A`, it does not**: `BasicPositionSizer` would size a 6A position
using the correct $10.00/tick, while `BasicRiskManager.ValidateOrder()` /
`CalculateTradeRisk()` would validate that same position's risk using
$12.50/tick instead — a 25% risk-calculation error, silently, if this
symbol is ever traded. `MaxTradeRisk` enforcement on 6A would currently be
wrong.
GAP-045/046 (this session) already confirmed `MNQ` is correctly present and
matching ($0.50) in both tables — this finding is about the tables'
remaining divergence, not about MNQ, and is not something GAP-045/046 was
scoped to catch (it only checked the specific symbol that task cared about).
## WHY IT MATTERS NOW
Not urgent for the currently-traded NQ (matches in both tables). But it's a
live, confirmed correctness defect the moment any strategy instance trades
6E or 6A, and the fact that these two tables have ALREADY diverged once
(silently, with nobody noticing until this review) is itself evidence this
pattern will keep drifting unless consolidated.
## READ-FIRST
1. Read both `GetTickValue` methods in full, side by side.
2. Check whether `NinjaTrader.Instrument.MasterInstrument.TickSize`/
`PointValue` is already used elsewhere in this codebase as a live,
correct tick-value source (yes — `NT8StrategyBase.ValidateStartupRiskConfiguration`,
added this session for GAP-045/046, already falls back to
`Instrument.MasterInstrument` when populated). Consider whether that's
available to `BasicRiskManager`/`BasicPositionSizer` too, or whether
those classes are intentionally platform-neutral (`NT8.Core`, no
NinjaTrader assembly reference) and therefore CANNOT reach
`Instrument.MasterInstrument` directly — confirm which before assuming
either approach is trivial.
## THE CHANGE
Consolidate to a single source of truth. Two reasonable shapes — pick one
and justify the choice in your writeback, don't silently default to
whichever is easiest:
**Option A — shared static table.** A single `TickValueTable` (or similar)
in `NT8.Core`, containing the union of both existing tables (add the
missing `6E`/`6A` entries), with both `BasicRiskManager.GetTickValue` and
`BasicPositionSizer.GetTickValue` calling into it. Smallest diff, keeps the
existing "hardcoded Phase 0 table, configurable later" architecture intact.
**Option B — resolve from `Instrument.MasterInstrument`** where available,
falling back to the hardcoded table only when the adapter can't supply it
(mirroring the pattern GAP-045/046 already established). Larger change,
removes the duplication-drift risk permanently rather than fixing today's
instance of it — but only pursue this if `NT8.Core`'s platform-neutrality
constraint doesn't block it; if it does, Option A is correct and Option B
should be logged as a future architectural note instead.
Either way: **add the missing `6E`/`6A` entries so `BasicRiskManager`
matches `BasicPositionSizer` exactly**, regardless of which structural
option you choose — that part is not optional.
## DO NOT
- Do not change `MaxTradeRisk`/`MaxStopTicks`/any other risk parameter for
NQ or MNQ as part of this — those are unaffected (both tables already
agree on those two).
- Do not change sizing or risk-validation logic itself, only the tick-value
lookup both already call into.
- Do not add new tradeable-symbol support beyond making the two tables
consistent (i.e. don't go add e.g. RTY or YM unless they were already in
one of the two tables).
## TESTS (required)
1. A test asserting `BasicRiskManager.GetTickValue` (or its consolidated
replacement) and `BasicPositionSizer.GetTickValue` (or its consolidated
replacement) return identical values for every symbol either currently
lists — this is the regression test that would have caught today's
6E/6A divergence and must catch any future one.
2. A test confirming `6A` now resolves to `$10.00` (not the old `$12.50`
default) from whichever code path `BasicRiskManager`'s risk calculation
actually uses.
## VALIDATION (operator)
None required — NQ/MNQ (the only currently-traded symbols) are unaffected
by this change; this closes a latent defect for symbols not currently in
use.
## GOVERNANCE
Track as [GAP-052] in SPRINT_BOARD.md. Update `docs/00-governance/decisions.md`
DEC-20260823-07 status to `implemented` with an implementation note stating
which option (A or B) was chosen and why, and confirming the platform-
neutrality question from READ-FIRST.
Reference: this task, DEC-20260823-07, GAP-045/GAP-046 (`d652e29`) for the
MNQ tick-value confirmation this finding builds on.