Complete market data backend: anchor, validation, keepalive, reconciliation - #6
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5.
The market data subsystem (
backend/app/market/) already had the Massive API client, unifiedMarketDataSourceinterface, GBM simulator, and 73 passing tests from an earlier PR.planning/MARKET_DATA_DESIGN.mdandplanning/REVIEW.mdflagged four follow-up items from PLAN.md's spec that were never built:PriceUpdate/PriceCache(anchor,day_change,day_change_percent), captured on first write and sticky thereaftervalidation.pyenforcing the 1-5 uppercase letter ticker format at the API boundary: keepalivecomment every ~15s when the cache is idlereconcile.pykeeping the tracked ticker set in sync with watchlist ∪ open positions, DB-agnostic pending the platform's DB layerAll 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 -vin backend/ before merging.Generated with Claude Code