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

1.4 KB · 28 lines · MySQL Raw History
 1-- finance migration 0007: dividend payout history (Phase 26).
 2--
 3-- A stock's per-event dividend history (ex-dividend date + per-share amount),
 4-- pulled from Yahoo's chart `events.dividends` series. Used on the symbol page
 5-- to show the payout cadence, prior-year and YTD totals, and an on-track pace
 6-- read. Stocks only: ETFs, indexes and futures do not pay regular dividends
 7-- in this app's sense.
 8
 9-- When this stock's dividend history was last refreshed from Yahoo. NULL =
10-- never. Driven by the new `dividends` scheduler job (weekly cadence).
11ALTER TABLE symbols ADD COLUMN dividends_synced_at INTEGER;
12
13-- One row per declared dividend payment. Keyed on (ticker, ex_date): a single
14-- payout is uniquely identified by its ex-dividend date — the first trading
15-- day on which a new buyer does NOT receive the upcoming payment, which is the
16-- date Yahoo's chart events series timestamps each event by.
17--
18-- Amounts are per-share, in the symbol's reporting currency (USD for the
19-- universe we follow). A correction or backfill of a known payout overwrites
20-- the prior amount via the primary-key conflict.
21CREATE TABLE dividends (
22    ticker  TEXT NOT NULL REFERENCES symbols(ticker) ON DELETE CASCADE,
23    ex_date TEXT NOT NULL,                  -- ex-dividend date, YYYY-MM-DD
24    amount  REAL NOT NULL,                  -- per-share, in symbols.currency
25    PRIMARY KEY (ticker, ex_date)
26);
27CREATE INDEX dividends_ticker_date ON dividends(ticker, ex_date DESC);