kjh2064
|
64bdc45260
|
Phase Segmentation: Full implementation with improved RegimeClassifier
Complete market regime classification and phase-specific metrics calculation.
Files:
- src/KArtSell.Modules.ModelOperations/ShadowRun/RegimeClassifier.cs (improved)
Threshold-based trend detection (Bull >2%, Bear <-2%, Sideways within band)
Deterministic PIT-safe classification, no lookahead bias
- src/KArtSell.Modules.ModelOperations/ShadowRun/PhaseMetricsCalculator.cs (new)
Per-phase metrics: Sharpe (annualized), Calmar, Max DD, Win Rate
Stateless calculation using only provided daily returns
- src/KArtSell.Modules.ModelOperations/ShadowRun/PhaseSegmentation.cs (new)
Orchestrator combining RegimeClassifier + PhaseMetricsCalculator
Groups returns by regime, calculates per-phase metrics
Returns PhaseBreakdownDto with all four market conditions
- tests/KArtSell.Integration.Tests/PhaseSegmentationTests.cs (updated)
Removed temporary implementations, now uses module classes
Test status: 8/8 PASSING
AGENTS.md v16.0:
✅ Pattern: Vertical component, single responsibility per class
✅ Simplicity: Clear threshold-based trend detection
✅ Maturity: Contract-first, test-first, implementation verified
✅ Necessity: Supports "복수 국면 OOS" requirement from README
Next: Integrate PhaseSegmentation into ShadowRunJob workflow.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
2026-08-02 12:10:38 +09:00 |
|
kjh2064
|
8a82f61660
|
Phase Segmentation: Contract + Tests + RegimeClassifier (AGENTS.md v16.0)
Implements PHASE_SEGMENTATION_CONTRACT for market regime classification
(Bull/Bear/Sideways/HighVolatility) with phase-specific metrics calculation.
Files:
- src/KArtSell.Modules.ModelOperations/ShadowRun/RegimeClassifier.cs
First-pass implementation using simple trend detection (first vs last price)
Static method, deterministic, PIT-safe classification
- src/KArtSell.Modules.ModelOperations/ShadowRun/PHASE_SEGMENTATION_CONTRACT.md
Full specification per AGENTS.md v16.0 (13-point checklist)
Input/output contracts, error handling, test scenarios
- tests/KArtSell.Integration.Tests/PhaseSegmentationTests.cs
8 tests: 6/8 passing (regime classification, metrics calculation, phase breakdown)
Includes test implementations for MarketRegime, PhaseMetricsCalculator, PhaseSegmentation
Status: Contract-First + Test-First complete; implementation ready for refinement
AGENTS.md v16.0:
✅ SOLID: Static classifier, DI-ready service interfaces
✅ Complexity: Simple trend detection (<10 cyclomatic)
✅ Audit: Deterministic classification, no lookahead bias
✅ Necessity: From README.md "복수 국면 OOS" requirement
✅ Pattern: Vertical component within ShadowRun orchestration
✅ Maturity: Contract → Test → Implementation sequencing
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
2026-08-02 12:07:51 +09:00 |
|
kjh2064
|
7dd300f5b5
|
feat: Infrastructure Implementation Phase — Database, Services, API integration
ci / backend (push) Failing after 1s
ci / static (push) Failing after 5s
ci / frontend (push) Failing after 39s
Implements AGENTS.md v16.0 Infrastructure Contract for 252+ trading-day shadow runs:
Database Schema:
- V0008_CreateShadowRunTable.sql: Immutable audit trail, PIT-safe queries
- Indexes: (model_id, created_at), (status), (published_at)
- JSONB columns for metrics/gates (flexible versioning)
Services (Vertical Slice pattern):
- KrxDataService: Fetch OHLCV + fees from Korea Exchange; caching (24h); retry logic
- MarketCalendarService: Trading sessions with KRX holidays (2024-2026 built-in)
- IKrxDataService, IMarketCalendarService interfaces (testable, mockable)
Tests (7/7 passing):
- KrxDataService: Fetch bars, cache hits, fee schedule
- MarketCalendarService: Session window, holiday exclusion, determinism, 252-day coverage
- All using xUnit IAsyncLifetime for proper resource cleanup
Architecture adherence:
- SOLID: Service interfaces, DI-ready, separation of concerns
- Complexity: Cyclomatic < 10 per method
- Idempotent: KRX caching prevents duplicate API calls; date ranges deterministic
- Safety: Tested cache hit/miss, holiday logic, 252-day window validation
Next Phase (When user requests):
- Shadow Run API Endpoint (FastEndpoints)
- Hangfire Job registration & startup integration
- E2E test: trigger shadow run → job → result persisted
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
2026-08-02 08:02:05 +09:00 |
|
kjh2064
|
0587a3f0a0
|
feat: Shadow Run Design Phase — 252+ trading-day validation framework
ci / backend (push) Failing after 1s
ci / static (push) Failing after 5s
ci / frontend (push) Failing after 41s
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>
|
2026-08-02 07:55:35 +09:00 |
|