Gsd/phase 02 trading portfolio - #183
Closed
didulobster wants to merge 108 commits into
Closed
didulobster wants to merge 108 commits into
didulobster wants to merge 108 commits into
Conversation
…987401410 Add Claude Code GitHub Workflow
Design for backend/app/market/: the unified MarketDataSource interface, the GBM simulator, the Massive (Polygon.io) REST client, the shared price cache, and the SSE endpoint. Every code block was executed and asserted before being written down; section 14 records what was measured. Notable findings, verified against massive 2.8.0 and 2.0.1: - TickerSnapshot.last_trade has no .timestamp attribute (it is sip_timestamp, in nanoseconds) and day has no change_percent or previous_close. Code written against the archived MASSIVE_API.md would raise AttributeError on every snapshot, silently skipping every ticker. Timestamps are now normalised by inferring the unit from magnitude. - PLAN.md section 10 requires a "daily change %" column, but nothing in the SSE field list supplied a session anchor. PriceUpdate now carries session_open and separates tick change from session change. - The correlation matrix is provably positive definite for any ticker composition (min eigenvalue 0.40); verified over a 3,400-case sweep. - httpx.ASGITransport buffers the whole response and deadlocks on an endless event stream, so SSE is tested through the generator directly. Also adds a heartbeat frame, deadline-based loop scheduling, poll backoff and chunking, and an atomic cache snapshot for the SSE version check. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013iS27g1qmsCs9TMefywGvm
Add detailed market data backend design
Add planning/MARKET_DATA_SUMMARY.md as the canonical market data design, reconciling the two overlapping designs (simple baseline wins; hardening items listed as deferred). Move detailed docs and the obsolete review to planning/archive/ with status headers. Correct PLAN.md on Massive free tier and the SSE payload, and CLAUDE.md on implementation status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Consolidate market data planning docs into one summary
- Market data: GBM simulator and Massive poller behind one interface, shared price cache, SSE stream at /api/stream/prices - SQLite schema with lazy init and seed data - Portfolio: trade execution, valuation, P&L, snapshots (30 s + per trade) - Watchlist CRUD; held tickers keep streaming after watchlist removal - LLM chat via LiteLLM -> OpenRouter (Cerebras) with structured output, auto-executed trades/watchlist changes, and LLM_MOCK mode - App wiring: lifespan, background tasks, static frontend serving - 46 unit/API tests; .env.example and backend README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement FastAPI backend
market_data_demo.py drives the real source -> PriceCache path and shows prices, tick direction, change since start, sparklines and shock events. Adds rich as a dev dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add live terminal market data demo
Complete FinAlly: frontend, Docker, E2E tests, backend hardening
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Phase 2 container gate green: compose path 01+03+04+06 = 9 passed - pytest 75 passed; integrity gates print gate-ok - finally image tag rebuilt at HEAD; probe PASS against it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- TradeResult carries the trade side; placeTrade sets it on every return - TradeBar resultColor(): muted idle, red rejection, green buy, neutral sell - 03-trading E2E asserts the buy, sell and rejection colors - UI-SPEC and CONTEXT D-02 amended per user decision 2026-09-26 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (G-02-1) - page.tsx: Trade panel drops the fixed md:h-24 height - TradeBar root uses min-h-16 instead of h-full - 03-trading E2E: Buy and Sell in viewport at 768x600 with chat open - UI-SPEC layout and trade bar contract, CONTEXT discretion note amended Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lValue (G-02-5) - vitest 5.0.2 pinned exactly (vite 8.3.1 peer, lockfile only), @types/node ^20 -> ^24, installed after the user approved the packages - "test": "vitest run"; no config file, no DOM environment - store/portfolio.test.ts: total = cash + qty x live price with the current_price fallback (JPM), and the same $4,716.83 header total within 1e-9 for all 24 orders - README: one line on npm test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- finally tag rebuilt at 5fab1b4; portfolio probe PASS on :8011 - compose path: 10 passed; vitest 2 passed; integrity gate-ok Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Boundary fixture (cash 7916.37; A 4.368@370.93, B 4.348@487.04, C 6.396@38.29) - Exact toBe equality across all 6 and all 24 orders; no tolerance assertions - Backend-matching 11899.14, empty positions and null cash cases - Fails on the float reduce: expected 11899.144999999999 to be 11899.145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e it - selectTotalValue adds cents(cash) and cents(qty x live price) per position, divides by 100 once - Matches backend get_portfolio per-position cents rounding (11899.14 at the boundary) - livePrice unchanged; module-private cents() helper - 02-UI-SPEC Header total bullet and loading row describe the whole-cents sum (G-02-5) Co-Authored-By: Claude Opus 5.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.
No description provided.