feat(demo): snapshot AAPL market data, serve in demo mode#242
Merged
Conversation
The Market tab in demo mode previously returned `{ results: null, error:
"Demo mode — market data is not available." }` for every endpoint —
visitors got an empty page. This wires up real AAPL data captured from
Alice's own market-data layer, frozen as JSON fixtures.
## Capture method
1. `pnpm dev` → Alice on :47331 (FMP provider via in-process
opentypebb, already configured with a working API key)
2. curl 9 endpoints with `?symbol=AAPL`:
- /api/market/search?query=AAPL
- /api/market-data-v1/equity/profile
- /api/market-data-v1/equity/price/quote
- /api/market-data-v1/equity/price/historical?interval=1d&start_date=…&end_date=…
- /api/market-data-v1/equity/fundamental/{metrics,ratios,balance,income,cash}
3. Save raw JSON responses verbatim to ui/src/demo/fixtures/market/.
Through-backend capture (rather than direct FMP) guarantees the
response shape matches whatever the UI expects, including any
opentypebb-layer normalization.
## Behavior
Handler returns the snapshot when `symbol === 'AAPL'`; for any other
symbol it returns `demoMarketEmpty` — a `{results:null, provider:
'demo', error:"Demo mode — only AAPL data is snapshotted. Install
OpenAlice locally to query other symbols."}` payload that the
UI's existing empty-state branch renders cleanly. No silent
"wrong-symbol-shows-Apple-data" failure mode.
Search matches `AAPL` / `apple` / any prefix of `apple inc.`.
## Verified
- pnpm -F open-alice-ui exec tsc -b: clean
- pnpm -F open-alice-ui build (prod): main chunk has zero `Apple Inc`
/ `aapl-equity` / `demoMarketAAPL` / `312.06` matches (single `MA50`
match traces to real UI's QuoteHeader.tsx column label, unrelated)
- pnpm dev:demo + Playwright walk:
- /market: search box prompts
- type "AAPL": dropdown shows "AAPL — Apple Inc. [EQUITY]"
- click: routes to /market/equity/AAPL, renders price 312.06 with
-0.45 (-0.14%) change, full quote panel (open/prev/high/low/
volume/mkt-cap/52w-high/52w-low/MA50/MA200), 62-bar daily candle
chart 2026-03-03→05-29, Profile + Key Metrics panels populated
Snapshot date: 2026-05-29 (provider=FMP). Resnap if a UI contract
change forces it — same capture method works.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
The Market tab was empty in demo mode — every endpoint returned `{ results: null, error: "Demo mode — market data is not available." }`. This PR captures real AAPL data from Alice's own market-data layer and freezes it as JSON fixtures, so visitors can search AAPL and see a real-looking equity detail page.
Snapshot method
Going through-backend (vs hitting FMP directly) guarantees the response shape matches what the UI expects — no manual translation layer, no opentypebb-layer normalization to recreate.
Handler behavior
Verified
Boundary touch
None — demo fixtures + handler only. The Alice backend was used to generate the fixtures but no production code modified.
Snapshot freshness
Date: 2026-05-29 (provider=FMP). When/if a UI contract change forces a re-snap, the same capture method works — boot Alice, curl with `?symbol=AAPL`, replace JSON files.
🤖 Generated with Claude Code