[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
This commit is contained in:
@@ -76,6 +76,9 @@
|
|||||||
**[GAP-051] `MicroUpgradeThreshold` advisory re-fires every restart** | Stage 1 | ✅ IMPLEMENTED — deploy skipped by operator
|
**[GAP-051] `MicroUpgradeThreshold` advisory re-fires every restart** | Stage 1 | ✅ IMPLEMENTED — deploy skipped by operator
|
||||||
- `_microUpgradeSuggested` resets to `false` in `State.SetDefaults`, which runs on every strategy enable — an account already above `MicroUpgradeThreshold` gets `TIER_UPGRADE_SUGGESTED` re-logged every restart, not once per lifetime. Advisory-only (`Print`/`FileLog`), never touches order flow, sizing, or risk.
|
- `_microUpgradeSuggested` resets to `false` in `State.SetDefaults`, which runs on every strategy enable — an account already above `MicroUpgradeThreshold` gets `TIER_UPGRADE_SUGGESTED` re-logged every restart, not once per lifetime. Advisory-only (`Print`/`FileLog`), never touches order flow, sizing, or risk.
|
||||||
- Prompt: `TASK_GAP051_MICRO_UPGRADE_PERSISTENCE_PROMPT.md`. Implemented Option A: once-per-account-lifetime advisory persistence in a dedicated `micro_upgrade_suggested_<Account>.json` file under the configured/default log directory. Missing/corrupt files safely fall back to allowing the reminder and logging a warning; `Account == null`/non-realtime paths perform no file I/O. Verification: focused tests 5/5, `verify-build.bat` 550/550, Core Release no-build 461/461. Deployment skipped per operator instruction.
|
- Prompt: `TASK_GAP051_MICRO_UPGRADE_PERSISTENCE_PROMPT.md`. Implemented Option A: once-per-account-lifetime advisory persistence in a dedicated `micro_upgrade_suggested_<Account>.json` file under the configured/default log directory. Missing/corrupt files safely fall back to allowing the reminder and logging a warning; `Account == null`/non-realtime paths perform no file I/O. Verification: focused tests 5/5, `verify-build.bat` 550/550, Core Release no-build 461/461. Deployment skipped per operator instruction.
|
||||||
|
**[GAP-052] Two hardcoded tick-value tables have already drifted out of sync** | Stage 1 | ✅ IMPLEMENTED — deploy skipped by operator
|
||||||
|
- `BasicRiskManager.GetTickValue` (6 symbols) and `BasicPositionSizer.GetTickValue` (8 symbols) disagreed: `BasicPositionSizer` supported `6E`/`6A`, while `BasicRiskManager` fell through to its `default: 12.50`. For `6A`, the real tick value is `$10.00`, creating a latent 25% risk-calculation error if traded. NQ/MNQ were unaffected and remain unchanged.
|
||||||
|
- Prompt: `TASK_GAP052_TICK_VALUE_CONSOLIDATION_PROMPT.md`. Implemented Option A: shared platform-neutral `InstrumentTickValueTable` containing the union of existing symbols (`ES`, `MES`, `NQ`, `MNQ`, `CL`, `GC`, `6E`, `6A`). Basic and Advanced risk/sizing helpers now delegate to the shared table, and `6A` risk validation uses `$10.00` instead of falling through to `$12.50`. Verification: focused tests 26/26, `verify-build.bat` 552/552, Core Release no-build 463/463. Deployment skipped per operator instruction.
|
||||||
### Also raised by the review, not yet prompted
|
### Also raised by the review, not yet prompted
|
||||||
GAP-051 (`MicroUpgradeThreshold` fires every session) · GAP-052 (two hardcoded tick-value tables) ·
|
GAP-051 (`MicroUpgradeThreshold` fires every session) · GAP-052 (two hardcoded tick-value tables) ·
|
||||||
GAP-053 (`executive_summary.md` and `roadmap.md` Sprint 3 list present ~12 completed tasks as open) ·
|
GAP-053 (`executive_summary.md` and `roadmap.md` Sprint 3 list present ~12 completed tasks as open) ·
|
||||||
|
|||||||
114
TASK_GAP052_TICK_VALUE_CONSOLIDATION_PROMPT.md
Normal file
114
TASK_GAP052_TICK_VALUE_CONSOLIDATION_PROMPT.md
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
# 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.
|
||||||
@@ -24,6 +24,15 @@ Use this file to record durable project decisions that affect implementation pat
|
|||||||
- **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs` (`MaybeWriteRejectSummarySnapshot`/`LogRejectRateLimited`/`ResetRejectTracking`/`WriteSessionHeader` ~1444-1517), `src/NT8.Strategies/Examples/SimpleORBStrategy.cs` (`OnBar` ~355-432, `RecordSignalRejection` ~1015-1026), `session_20260823_230519.log`
|
- **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs` (`MaybeWriteRejectSummarySnapshot`/`LogRejectRateLimited`/`ResetRejectTracking`/`WriteSessionHeader` ~1444-1517), `src/NT8.Strategies/Examples/SimpleORBStrategy.cs` (`OnBar` ~355-432, `RecordSignalRejection` ~1015-1026), `session_20260823_230519.log`
|
||||||
- **Implementation Note (2026-08-25):** GAP-060 implemented as logging/observability only. `NT8StrategyBase.MaybeWriteRejectSummarySnapshot()` no longer has a blanket midnight-to-10:00 AM suppression gate; suppression now delegates to an ORB-window-aware helper and `SimpleORBNT8` overrides that helper so the suppressed window is today's configured 09:30 + `OpeningRangeMinutes`. The once-after-ORB snapshot flag now resets per `barTime.Date`, allowing a new post-ORB summary every day in a continuous multi-day session. `OnBarUpdate()` now calls `MaybeWriteRejectSummarySnapshot(Time[0])` on the live bar heartbeat after the first realtime-bar guard, so 15-minute summary cadence can flush from regular processed bars and is not solely dependent on a newly logged reject. Existing `_rejectDetailsLogged` one-detail-line-per-reason rate limiting, reject reason strings, `REJECT:`/`REJECT SUMMARY:` formats, order flow, sizing, risk, and real trade decisions were unchanged. Open question resolved as possibility **(a)**: the missing `OrbRangeNotEstablished` visibility was adapter summary reporting, not a second SimpleORB rejection defect. A focused `SimpleORBStrategy.OnBar()` test proves the no-breakout RTH path records `OrbRangeNotEstablished` both while the ORB is building and after ORB close when no breakout confirms. Verification: focused GAP-060 tests passed 8/8; `verify-build.bat` passed with 543/543 tests (454 Core, 79 Integration, 10 Performance); `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 454/454.
|
- **Implementation Note (2026-08-25):** GAP-060 implemented as logging/observability only. `NT8StrategyBase.MaybeWriteRejectSummarySnapshot()` no longer has a blanket midnight-to-10:00 AM suppression gate; suppression now delegates to an ORB-window-aware helper and `SimpleORBNT8` overrides that helper so the suppressed window is today's configured 09:30 + `OpeningRangeMinutes`. The once-after-ORB snapshot flag now resets per `barTime.Date`, allowing a new post-ORB summary every day in a continuous multi-day session. `OnBarUpdate()` now calls `MaybeWriteRejectSummarySnapshot(Time[0])` on the live bar heartbeat after the first realtime-bar guard, so 15-minute summary cadence can flush from regular processed bars and is not solely dependent on a newly logged reject. Existing `_rejectDetailsLogged` one-detail-line-per-reason rate limiting, reject reason strings, `REJECT:`/`REJECT SUMMARY:` formats, order flow, sizing, risk, and real trade decisions were unchanged. Open question resolved as possibility **(a)**: the missing `OrbRangeNotEstablished` visibility was adapter summary reporting, not a second SimpleORB rejection defect. A focused `SimpleORBStrategy.OnBar()` test proves the no-breakout RTH path records `OrbRangeNotEstablished` both while the ORB is building and after ORB close when no breakout confirms. Verification: focused GAP-060 tests passed 8/8; `verify-build.bat` passed with 543/543 tests (454 Core, 79 Integration, 10 Performance); `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 454/454.
|
||||||
- **Action Required:** Deployment remains pending. `deployment\deploy-to-nt8.bat` was attempted on 2026-08-25 but failed because NinjaTrader.exe PID 18800 locked `NT8.Core.dll`; operator instructed Kilocode to commit without deploy. After NinjaTrader is closed, rerun deployment, start NT8, manually compile NinjaScript, and in the next SIM session spanning a full trading day confirm `REJECT SUMMARY` appears throughout RTH at a reasonable cadence.
|
- **Action Required:** Deployment remains pending. `deployment\deploy-to-nt8.bat` was attempted on 2026-08-25 but failed because NinjaTrader.exe PID 18800 locked `NT8.Core.dll`; operator instructed Kilocode to commit without deploy. After NinjaTrader is closed, rerun deployment, start NT8, manually compile NinjaScript, and in the next SIM session spanning a full trading day confirm `REJECT SUMMARY` appears throughout RTH at a reasonable cadence.
|
||||||
|
### DEC-20260823-07
|
||||||
|
- **ID:** DEC-20260823-07
|
||||||
|
- **Date:** 2026-08-23/24
|
||||||
|
- **Status:** implemented
|
||||||
|
- **Context:** GAP-052 was flagged by the original v7.0 review as "two hardcoded tick-value tables" without further detail. Confirmed duplicated `GetTickValue(string symbol)` helpers in Basic risk/sizing and additional Advanced risk/sizing helpers. The concrete defect was `6A`: `BasicPositionSizer` used `$10.00` while `BasicRiskManager` fell through to `$12.50`, producing a 25% risk-calculation mismatch if 6A were traded. NQ/MNQ were already consistent and remain unchanged.
|
||||||
|
- **Decision:** Implement Option A — a shared static table — because `BasicRiskManager`, `BasicPositionSizer`, `AdvancedRiskManager`, and `AdvancedPositionSizer` live in platform-neutral `NT8.Core` and cannot directly depend on NinjaTrader `Instrument.MasterInstrument` APIs without changing project layering. Option B remains a possible future adapter-supplied enhancement, not part of this platform-neutral fix.
|
||||||
|
- **Implementation Note (2026-08-25):** Added `NT8.Core.Common.InstrumentTickValueTable` with the union of existing supported symbols (`ES`, `MES`, `NQ`, `MNQ`, `CL`, `GC`, `6E`, `6A`) and updated all four risk/sizing helpers to delegate to it. This fixes the concrete `6A` defect (`$10.00` instead of the old BasicRiskManager `$12.50` default) and removes the duplicated hardcoded tables from those helpers. Verification: focused `BasicRiskManagerTests` passed 26/26; `verify-build.bat` passed with 552/552 tests (463 Core, 79 Integration, 10 Performance); `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 463/463.
|
||||||
|
- **Related Files:** `src/NT8.Core/Common/InstrumentTickValueTable.cs`, `src/NT8.Core/Risk/BasicRiskManager.cs`, `src/NT8.Core/Sizing/BasicPositionSizer.cs`, `src/NT8.Core/Risk/AdvancedRiskManager.cs`, `src/NT8.Core/Sizing/AdvancedPositionSizer.cs`, `tests/NT8.Core.Tests/Risk/BasicRiskManagerTests.cs`, `TASK_GAP052_TICK_VALUE_CONSOLIDATION_PROMPT.md`
|
||||||
|
- **Action Required:** Deployment intentionally skipped per operator instruction. No operator validation required for currently traded NQ/MNQ; both remain unchanged at `$5.00`/`$0.50`.
|
||||||
### DEC-20260823-06
|
### DEC-20260823-06
|
||||||
- **ID:** DEC-20260823-06
|
- **ID:** DEC-20260823-06
|
||||||
- **Date:** 2026-08-23/24
|
- **Date:** 2026-08-23/24
|
||||||
|
|||||||
47
src/NT8.Core/Common/InstrumentTickValueTable.cs
Normal file
47
src/NT8.Core/Common/InstrumentTickValueTable.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace NT8.Core.Common
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Shared Phase 0 tick-value lookup for platform-neutral risk and sizing components.
|
||||||
|
/// </summary>
|
||||||
|
public static class InstrumentTickValueTable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the currency value of one tick for the supplied symbol.
|
||||||
|
/// </summary>
|
||||||
|
public static double GetTickValue(string symbol)
|
||||||
|
{
|
||||||
|
switch (symbol)
|
||||||
|
{
|
||||||
|
case "ES": return 12.50;
|
||||||
|
case "MES": return 1.25;
|
||||||
|
case "NQ": return 5.00;
|
||||||
|
case "MNQ": return 0.50;
|
||||||
|
case "CL": return 10.00;
|
||||||
|
case "GC": return 10.00;
|
||||||
|
case "6E": return 12.50;
|
||||||
|
case "6A": return 10.00;
|
||||||
|
default: return 12.50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets supported symbols with their tick values.
|
||||||
|
/// </summary>
|
||||||
|
public static Dictionary<string, double> GetSupportedSymbols()
|
||||||
|
{
|
||||||
|
var symbols = new Dictionary<string, double>();
|
||||||
|
symbols.Add("ES", 12.50);
|
||||||
|
symbols.Add("MES", 1.25);
|
||||||
|
symbols.Add("NQ", 5.00);
|
||||||
|
symbols.Add("MNQ", 0.50);
|
||||||
|
symbols.Add("CL", 10.00);
|
||||||
|
symbols.Add("GC", 10.00);
|
||||||
|
symbols.Add("6E", 12.50);
|
||||||
|
symbols.Add("6A", 10.00);
|
||||||
|
return symbols;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using NT8.Core.Common;
|
||||||
using NT8.Core.Common.Models;
|
using NT8.Core.Common.Models;
|
||||||
using NT8.Core.Logging;
|
using NT8.Core.Logging;
|
||||||
using System;
|
using System;
|
||||||
@@ -539,17 +540,7 @@ namespace NT8.Core.Risk
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static double GetTickValue(string symbol)
|
private static double GetTickValue(string symbol)
|
||||||
{
|
{
|
||||||
// Static tick values - will be enhanced with dynamic lookup in future phases
|
return InstrumentTickValueTable.GetTickValue(symbol);
|
||||||
switch (symbol)
|
|
||||||
{
|
|
||||||
case "ES": return 12.50;
|
|
||||||
case "MES": return 1.25;
|
|
||||||
case "NQ": return 5.00;
|
|
||||||
case "MNQ": return 0.50;
|
|
||||||
case "CL": return 10.00;
|
|
||||||
case "GC": return 10.00;
|
|
||||||
default: return 12.50; // Default to ES
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -931,4 +922,4 @@ namespace NT8.Core.Risk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using NT8.Core.Common;
|
||||||
using NT8.Core.Common.Models;
|
using NT8.Core.Common.Models;
|
||||||
using NT8.Core.Logging;
|
using NT8.Core.Logging;
|
||||||
using System;
|
using System;
|
||||||
@@ -177,17 +178,7 @@ namespace NT8.Core.Risk
|
|||||||
|
|
||||||
private static double GetTickValue(string symbol)
|
private static double GetTickValue(string symbol)
|
||||||
{
|
{
|
||||||
// Static tick values for Phase 0 - will be configurable in Phase 1
|
return InstrumentTickValueTable.GetTickValue(symbol);
|
||||||
switch (symbol)
|
|
||||||
{
|
|
||||||
case "ES": return 12.50;
|
|
||||||
case "MES": return 1.25;
|
|
||||||
case "NQ": return 5.00;
|
|
||||||
case "MNQ": return 0.50;
|
|
||||||
case "CL": return 10.00;
|
|
||||||
case "GC": return 10.00;
|
|
||||||
default: return 12.50; // Default to ES
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -195,14 +186,7 @@ namespace NT8.Core.Risk
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static Dictionary<string, double> GetSupportedSymbols()
|
public static Dictionary<string, double> GetSupportedSymbols()
|
||||||
{
|
{
|
||||||
var symbols = new Dictionary<string, double>();
|
return InstrumentTickValueTable.GetSupportedSymbols();
|
||||||
symbols.Add("ES", 12.50);
|
|
||||||
symbols.Add("MES", 1.25);
|
|
||||||
symbols.Add("NQ", 5.00);
|
|
||||||
symbols.Add("MNQ", 0.50);
|
|
||||||
symbols.Add("CL", 10.00);
|
|
||||||
symbols.Add("GC", 10.00);
|
|
||||||
return symbols;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetOpenPositionCount()
|
private int GetOpenPositionCount()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using NT8.Core.Common;
|
||||||
using NT8.Core.Common.Models;
|
using NT8.Core.Common.Models;
|
||||||
using NT8.Core.Intelligence;
|
using NT8.Core.Intelligence;
|
||||||
using NT8.Core.Logging;
|
using NT8.Core.Logging;
|
||||||
@@ -506,19 +507,7 @@ namespace NT8.Core.Sizing
|
|||||||
|
|
||||||
private static double GetTickValue(string symbol)
|
private static double GetTickValue(string symbol)
|
||||||
{
|
{
|
||||||
// Static tick values for Phase 0 - will be configurable in Phase 1
|
return InstrumentTickValueTable.GetTickValue(symbol);
|
||||||
switch (symbol)
|
|
||||||
{
|
|
||||||
case "ES": return 12.50; // E-mini S&P 500
|
|
||||||
case "MES": return 1.25; // Micro E-mini S&P 500
|
|
||||||
case "NQ": return 5.00; // E-mini NASDAQ-100
|
|
||||||
case "MNQ": return 0.50; // Micro E-mini NASDAQ-100
|
|
||||||
case "CL": return 10.00; // Crude Oil
|
|
||||||
case "GC": return 10.00; // Gold
|
|
||||||
case "6E": return 12.50; // Euro FX
|
|
||||||
case "6A": return 10.00; // Australian Dollar
|
|
||||||
default: return 12.50; // Default to ES value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SizingMetadata GetMetadata()
|
public SizingMetadata GetMetadata()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using NT8.Core.Common;
|
||||||
using NT8.Core.Common.Models;
|
using NT8.Core.Common.Models;
|
||||||
using NT8.Core.Logging;
|
using NT8.Core.Logging;
|
||||||
using System;
|
using System;
|
||||||
@@ -154,19 +155,7 @@ namespace NT8.Core.Sizing
|
|||||||
|
|
||||||
private static double GetTickValue(string symbol)
|
private static double GetTickValue(string symbol)
|
||||||
{
|
{
|
||||||
// Static tick values for Phase 0 - will be configurable in Phase 1
|
return InstrumentTickValueTable.GetTickValue(symbol);
|
||||||
switch (symbol)
|
|
||||||
{
|
|
||||||
case "ES": return 12.50; // E-mini S&P 500
|
|
||||||
case "MES": return 1.25; // Micro E-mini S&P 500
|
|
||||||
case "NQ": return 5.00; // E-mini NASDAQ-100
|
|
||||||
case "MNQ": return 0.50; // Micro E-mini NASDAQ-100
|
|
||||||
case "CL": return 10.00; // Crude Oil
|
|
||||||
case "GC": return 10.00; // Gold
|
|
||||||
case "6E": return 12.50; // Euro FX
|
|
||||||
case "6A": return 10.00; // Australian Dollar
|
|
||||||
default: return 12.50; // Default to ES value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SizingMetadata GetMetadata()
|
public SizingMetadata GetMetadata()
|
||||||
@@ -230,17 +219,7 @@ namespace NT8.Core.Sizing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static Dictionary<string, double> GetSupportedSymbols()
|
public static Dictionary<string, double> GetSupportedSymbols()
|
||||||
{
|
{
|
||||||
var symbols = new Dictionary<string, double>();
|
return InstrumentTickValueTable.GetSupportedSymbols();
|
||||||
symbols.Add("ES", 12.50);
|
|
||||||
symbols.Add("MES", 1.25);
|
|
||||||
symbols.Add("NQ", 5.00);
|
|
||||||
symbols.Add("MNQ", 0.50);
|
|
||||||
symbols.Add("CL", 10.00);
|
|
||||||
symbols.Add("GC", 10.00);
|
|
||||||
symbols.Add("6E", 12.50);
|
|
||||||
symbols.Add("6A", 10.00);
|
|
||||||
|
|
||||||
return symbols;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using NT8.Core.Risk;
|
using NT8.Core.Risk;
|
||||||
|
using NT8.Core.Common;
|
||||||
using NT8.Core.Common.Models;
|
using NT8.Core.Common.Models;
|
||||||
using NT8.Core.Logging;
|
using NT8.Core.Logging;
|
||||||
using NT8.Core.Sizing;
|
using NT8.Core.Sizing;
|
||||||
@@ -376,6 +377,40 @@ namespace NT8.Core.Tests.Risk
|
|||||||
Assert.AreEqual(0.50, sizingSymbols["MNQ"]);
|
Assert.AreEqual(0.50, sizingSymbols["MNQ"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetSupportedSymbols_RiskAndSizingUseSharedUnionTickValueTable()
|
||||||
|
{
|
||||||
|
Dictionary<string, double> sharedSymbols = InstrumentTickValueTable.GetSupportedSymbols();
|
||||||
|
Dictionary<string, double> riskSymbols = BasicRiskManager.GetSupportedSymbols();
|
||||||
|
Dictionary<string, double> sizingSymbols = BasicPositionSizer.GetSupportedSymbols();
|
||||||
|
|
||||||
|
Assert.AreEqual(sharedSymbols.Count, riskSymbols.Count);
|
||||||
|
Assert.AreEqual(sharedSymbols.Count, sizingSymbols.Count);
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, double> symbol in sharedSymbols)
|
||||||
|
{
|
||||||
|
Assert.IsTrue(riskSymbols.ContainsKey(symbol.Key), symbol.Key);
|
||||||
|
Assert.IsTrue(sizingSymbols.ContainsKey(symbol.Key), symbol.Key);
|
||||||
|
Assert.AreEqual(symbol.Value, riskSymbols[symbol.Key], 0.000001, symbol.Key);
|
||||||
|
Assert.AreEqual(symbol.Value, sizingSymbols[symbol.Key], 0.000001, symbol.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void ValidateOrder_SixAustralianDollar_UsesTenDollarTickValue()
|
||||||
|
{
|
||||||
|
var intent = TestDataBuilder.CreateValidIntent(symbol: "6A", stopTicks: 10);
|
||||||
|
var context = TestDataBuilder.CreateTestContext(symbol: "6A");
|
||||||
|
var config = new RiskConfig(1000.0, 100.0, 5, true);
|
||||||
|
|
||||||
|
RiskDecision decision = _riskManager.ValidateOrder(intent, context, config, 1);
|
||||||
|
|
||||||
|
Assert.IsTrue(decision.Allow, decision.RejectReason);
|
||||||
|
Assert.IsTrue(decision.RiskMetrics.ContainsKey("trade_risk"));
|
||||||
|
Assert.AreEqual(100.0, (double)decision.RiskMetrics["trade_risk"], 0.000001);
|
||||||
|
Assert.AreEqual(10.00, InstrumentTickValueTable.GetTickValue("6A"), 0.000001);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetRiskStatus_ReturnsConfiguredDailyLossLimit()
|
public void GetRiskStatus_ReturnsConfiguredDailyLossLimit()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user