repos
/ finance-rust master

finance-rust

mirror archived upstream

Single-binary self-hosted market watcher for stocks, ETFs, indexes, and futures: live charts, key stats, fundamentals, SEC filings, and SSE streaming.

axumdockerfinancerustself-hostedsqlitestocksvite

980 B · 21 lines · MySQL Raw History
 1-- Phase C: session-scoped dashboard watchlists.
 2--
 3-- The demand-only refocus made the dashboard a personal, editable watchlist
 4-- rather than a fixed view. There are no accounts: a browser is identified by
 5-- an opaque `fin_sid` cookie, and its watchlist symbols live here keyed on that
 6-- sid. Clearing the browser's cookies loses the list (acceptable by design).
 7-- The S&P 500 baseline is not stored — it is always shown by the dashboard.
 8--
 9-- `position` orders the list as the user arranged it; `added_at` is a tiebreak.
10-- The FK cascades a symbol prune (seed reconcile) into the watchlists, so a
11-- dropped universe symbol cannot linger as a dangling watchlist row.
12CREATE TABLE watchlist (
13    sid       TEXT    NOT NULL,
14    ticker    TEXT    NOT NULL REFERENCES symbols(ticker) ON DELETE CASCADE,
15    position  INTEGER NOT NULL DEFAULT 0,
16    added_at  INTEGER NOT NULL,
17    PRIMARY KEY (sid, ticker)
18);
19
20CREATE INDEX idx_watchlist_sid ON watchlist (sid, position);