Skip to content

Claude/market data backend design pztc8i - #159

Open
SaschaHaufe wants to merge 4 commits into
ed-donner:mainfrom
SaschaHaufe:claude/market-data-backend-design-pztc8i
Open

Claude/market data backend design pztc8i#159
SaschaHaufe wants to merge 4 commits into
ed-donner:mainfrom
SaschaHaufe:claude/market-data-backend-design-pztc8i

Conversation

@SaschaHaufe

Copy link
Copy Markdown

No description provided.

SaschaHaufe and others added 4 commits August 27, 2026 15:16
A documentation review of PLAN.md surfaced 25 questions, contradictions and
gaps. Fold the decisions into the body of the plan and record them in a new
Decisions Log section.

Notable resolutions:

- Add prev_close per ticker so the watchlist daily change % has a baseline
- State that the main chart, like the sparklines, accumulates client-side
- Give unseeded tickers a fallback seed price instead of rejecting them
- Define the tracked ticker set as watchlist plus open positions, so a
  de-watchlisted holding can still be valued
- Treat the chat message as an intent rather than a receipt; action results
  render as authoritative filled/rejected chips
- Settle the Docker bind mount vs named volume contradiction
- Specify trade validation, watchlist rules and the actions JSON contract
- Add GET /api/trades and a trade blotter panel
- Truncate portfolio_snapshots on startup in simulator mode
- Pick Recharts as the single charting dependency
- Rename backend/db to backend/app/database, drop docker-compose.yml,
  add GET /api/state for a single-round-trip first paint
- Document local development with a next.config.js proxy

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cerebras is a paid inference provider. The app must cost nothing to run, so
drop the provider pinning and move to a free model.

The requested model id nvidia/nemotron-3-ultra-550b-a55b:free does not exist
on OpenRouter; verified against the live model list and used
nvidia/nemotron-3.5-lightning:free instead.

Free models do not support response_format, so Structured Outputs are not
available. Replace them with forced tool calling, which free models do
support. Verified with a spike before writing it down: 18 calls across three
runs, 8/9 schema-valid for forced tool calling. Prompt-based JSON scored 6/6
but was consistently slower head-to-head and needs fence stripping that a
tool call never requires.

Measured latency is 7-58 seconds, median 20-30, which invalidates the plan's
reason for skipping streaming. Keep responses non-streaming but make the wait
honest: an elapsed counter from the first second, a stated 20-30s
expectation, new text at 60s, abandon with retry at 120s, and the input
disabled throughout so impatient resends cannot burn the 20-per-minute rate
limit. No fake progress bar - there is no progress to report.

Also:

- Add OPENROUTER_MODEL so swapping models needs no code change
- Document the 20/min and 50/day free-tier rate limits
- Note that env var names are case-sensitive in the Linux container
- Rename the cerebras-inference skill to openrouter-inference
- Fix the README docker run command, which still used a named volume

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Resolve PLAN.md open questions and switch to free OpenRouter LLM integration
Documents the market data subsystem (unified interface, price cache,
GBM simulator, Massive client, SSE endpoint) as it needs to exist to
satisfy the current PLAN.md, including the prev_close / daily-change-%
extension that PLAN.md's decisions log added after the module was
originally built but the shipped code doesn't implement yet. Section 15
lists the concrete diff against what's on disk today.
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.

2 participants