Skip to content

Complete market data backend: anchor, validation, keepalive, reconciliation - #6

Merged
Piyushpal77 merged 1 commit into
mainfrom
claude/issue-5-20260911-1228
Sep 11, 2026
Merged

Piyushpal77 merged 1 commit into
mainfrom
claude/issue-5-20260911-1228

Conversation

@Piyushpal77

Copy link
Copy Markdown
Owner

Closes #5.

The market data subsystem (backend/app/market/) already had the Massive API client, unified MarketDataSource interface, GBM simulator, and 73 passing tests from an earlier PR. planning/MARKET_DATA_DESIGN.md and planning/REVIEW.md flagged four follow-up items from PLAN.md's spec that were never built:

  • Day-change anchor on PriceUpdate/PriceCache (anchor, day_change, day_change_percent), captured on first write and sticky thereafter
  • New validation.py enforcing the 1-5 uppercase letter ticker format at the API boundary
  • SSE : keepalive comment every ~15s when the cache is idle
  • New reconcile.py keeping the tracked ticker set in sync with watchlist ∪ open positions, DB-agnostic pending the platform's DB layer

All changes are additive; existing call sites are unaffected. Extended test_models.py, test_cache.py, test_massive.py, plus new test_validation.py, test_stream.py, test_reconcile.py.

Note: test suite was reviewed by hand; please run uv run --extra dev pytest -v in backend/ before merging.

Generated with Claude Code

…SE keepalive, tracked-ticker reconciliation

The market data subsystem (backend/app/market/) already had the Massive API
client, the unified MarketDataSource interface, the GBM simulator, and 73
passing unit tests from an earlier PR. planning/MARKET_DATA_DESIGN.md and
planning/REVIEW.md had flagged four follow-up items from PLAN.md's spec that
were never built; this closes all four so the subsystem matches the plan:

- PriceUpdate/PriceCache gain a day-change anchor (anchor, day_change,
  day_change_percent), captured on first write and sticky thereafter
- New validation.py enforces the 1-5 uppercase letter ticker format at the
  API boundary
- stream.py emits a ": keepalive" SSE comment every ~15s when the cache is
  idle, so the frontend can distinguish idle from disconnected
- New reconcile.py keeps a MarketDataSource's tracked set in sync with
  watchlist union open positions, DB-agnostic pending the platform's DB layer

All changes are additive; existing call sites are unaffected. Added/extended
unit tests across test_models.py, test_cache.py, test_massive.py, plus new
test_validation.py, test_stream.py, test_reconcile.py.

Co-authored-by: Piyush Pal <120164578+Piyushpal77@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Piyushpal77
Piyushpal77 merged commit c06e8da into main Sep 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build complete market data backend

1 participant