feat: Shadow Run Design Phase — 252+ trading-day validation framework
Implements foundation for model evaluation per AGENTS.md v16.0: - Domain models: ShadowRunCommand, ShadowRunResult, ValidationGates - Data backfiller: OHLCV + fee schedule collection from KRX API - Replay engine: Historical model simulation with signal/order/fill tracking - Metrics calculator: Sharpe, Calmar, PBO, DSR, Max Drawdown, Win Rate - Hangfire job orchestrator: Async shadow run execution (q-research queue) - Integration tests: 4/4 passing (backfill, replay, metrics, validation) Contract validation: - Input: Model ID, date window, market phase filter - Output: Immutable result with phase breakdown, gate status - Gates: PBO ≤ 20%, DSR ≥ 95%, cost 2x positive Architecture adherence: - SOLID: Single responsibility (backfiller, replay, calculator separation) - Complexity: Cyclomatic < 10 per method - Safety: Idempotent replay via deterministic price/order fills - Necessity: Grounded in CLAUDE.md § "Validation Gates" - Pattern: Vertical Slice (Command → Handler → Queries) Not included (future): - Full 252-day rehearsal (requires market data backfill) - Downstream inbox consumers (event delivery mechanisms) - Phase segmentation logic (Bull/Bear/Sideways attribution) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
namespace KArtSell.Modules.ModelOperations.ShadowRun;
|
||||
|
||||
/// <summary>
|
||||
/// Command to initiate a 252+ trading-day shadow run for model validation.
|
||||
/// </summary>
|
||||
public sealed record ShadowRunCommand(
|
||||
Guid ModelId,
|
||||
Guid CorrelationId,
|
||||
Guid IdempotencyKey,
|
||||
DateOnly WindowStartDate,
|
||||
DateOnly WindowEndDate,
|
||||
MarketPhaseFilter PhaseFilter = MarketPhaseFilter.All)
|
||||
{
|
||||
public Guid RunId { get; } = Guid.NewGuid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Market phases for segmented analysis during shadow run.
|
||||
/// </summary>
|
||||
public enum MarketPhaseFilter
|
||||
{
|
||||
All = 0,
|
||||
BullMarket = 1,
|
||||
BearMarket = 2,
|
||||
Sideways = 3,
|
||||
HighVolatility = 4
|
||||
}
|
||||
Reference in New Issue
Block a user