Commit Graph

3 Commits

Author SHA1 Message Date
jgrusewski
21ecfc9410 fix(cockpit): DATE column for hypertable + sample-variance welford + test import order
- cockpit_models.py: ForwardNavRow.date changed from String(10) to Date so
  TimescaleDB create_hypertable('forward_nav', by_range('date')) accepts the
  column; Mapped type updated to dt.date accordingly.
- forward_nav.py: upsert_rows converts DTO ISO str → dt.date.fromisoformat()
  before writing; nav_history converts dt.date → .isoformat() when building
  NavRowDTO, preserving the ISO-string public contract end-to-end.
  StaticPool comment corrected: it is only applied for in-memory SQLite, not Postgres.
- state_reader.py: _welford now uses sample variance (/(n-1)) with the
  two-moment formula to match _sharpe; added clarifying comment that sumsq_r
  is raw sum-of-squares, not a Welford M2 accumulator.
- tests/unit/test_state_reader.py: moved import json / math / ForwardStateReader
  to top of file; added test_welford_sample_variance_sharpe to lock the
  variance formula against a known small fixture (days=2).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 11:43:47 +02:00
jgrusewski
a7829fafd3 feat(cockpit): state_reader normalizes the three tracker state families
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 11:31:35 +02:00
jgrusewski
45ea11614e feat(cockpit): forward read-model DTOs (ForwardSummary, ForwardNavRow, GateVerdict)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 11:30:39 +02:00