> Every Taji docs page as Markdown: https://docs.taji.is/llms.txt

# Yahoo Finance: how it works

Yahoo Finance is Taji's keyless default data source. From it Taji takes delayed and real-time bars, quotes, option chains, open interest, corporate actions, earnings, statements, short interest, analyst targets, news, search, predefined screens, and the market's earnings, splits, IPO and economic calendars. It needs no account and no key. The crate is `plugins/yahoo` (`taji-yahoo`), a data source only, with no venue and no link form. Its reads call the Python library yfinance in a confined worker process. Its live prints come off Yahoo's streamer socket, which the crate reads in Rust.

## The vendor

**No published API.** Yahoo documents no public market-data API, no auth scheme and no rate limit. Its terms forbid collecting data "using any automated means … without our express, prior permission" and forbid reuse "for any commercial purpose" ([Yahoo Terms of Service](https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html), §2(d) and §2(e), fetched 2026-12-02). The interface Taji programs against is yfinance, an open-source client that "is not affiliated, endorsed, or vetted by Yahoo" and says Yahoo's API "is intended for personal use only" ([yfinance README](https://github.com/ranaroussi/yfinance), fetched 2026-12-02). Every vendor fact below is yfinance's code or docs at the pinned 1.8.0 tag, or Taji's own measurement in the README.

**Hosts and environments.** Yahoo has one environment: no paper, no sandbox. yfinance 1.8.0 calls:

- `query1.finance.yahoo.com` and `query2.finance.yahoo.com`: the JSON pages (`yfinance/const.py:1-2`);
- `fc.yahoo.com`, `guce.yahoo.com` and `consent.yahoo.com`: the cookie and consent handshake;
- `finance.yahoo.com`: the root and scraped pages.

The streamer is `wss://streamer.finance.yahoo.com/?version=2` (`yfinance/live.py:17`).

**Auth.** Taji holds no credential, but yfinance sends a cookie and a crumb ([`yfinance/data.py` at 1.8.0](https://raw.githubusercontent.com/ranaroussi/yfinance/1.8.0/yfinance/data.py), fetched 2026-12-02). It gets them by one of two strategies:

- **`basic`:** a GET to `https://fc.yahoo.com` for the cookie, then `query1…/v1/test/getcrumb` for the crumb.
- **`csrf`:** the consent form at `guce.yahoo.com/consent`, posted to `consent.yahoo.com/v2/collectConsent`, then `query2…/v1/test/getcrumb`.

A response of 400 or more switches strategy, fetches a fresh cookie and crumb, and retries once. A 429 raises `YFRateLimitError`. Neither has a stated lifetime: yfinance caches the cookie on disk until it expires.

**API families Taji calls**, through yfinance 1.8.0:

| Family | Yahoo endpoint | yfinance call |
|---|---|---|
| Chart | `query2…/v8/finance/chart/{symbol}` (`scrapers/history.py:282`) | `Ticker.history` |
| Quote summary | `query2…/v10/finance/quoteSummary` (`scrapers/quote.py:43`) | `Ticker.info`, `calendar`, `analyst_price_targets`, `recommendations`, `upgrades_downgrades` |
| Quote | `query1…/v7/finance/quote?symbols=` (`scrapers/quote.py:671`), many symbols a request | `YfData().get_raw_json`, the call `Ticker.info` adds |
| Options | `query2…/v7/finance/options/{ticker}` (`ticker.py:48`) | `Ticker.options`, `option_chain` |
| Fundamentals timeseries | `query2…/ws/fundamentals-timeseries/v1/finance/timeseries/{symbol}` (`scrapers/fundamentals.py:125`) | `get_income_stmt`, `get_balance_sheet`, `get_cash_flow` |
| Search | `query2…/v1/finance/search` (`search.py:84`) | `yf.Search(...).quotes`, `.news` |
| Screener | `query1…/v1/finance/screener/predefined/saved` (`screener/screener.py:16`) | `yf.screen(name, count)` |
| Visualization (calendars) | POST `query1…/v1/finance/visualization` (`calendars.py:78`) | `Calendars`; the economic calendar's body is built by `yahoo.py` itself |
| Earnings page | `finance.yahoo.com` calendar page | `Ticker.get_earnings_dates` |
| Streamer | `wss://streamer.finance.yahoo.com/?version=2` | none: Taji's own client in `plugins/yahoo/src/stream.rs` |

The yfinance docs for these calls are the [API reference](https://ranaroussi.github.io/yfinance/reference/index.html) and its pages for [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html), [`Search`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Search.html), [`Calendars`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Calendars.html), [`screen`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.screen.html) and [`WebSocket`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.WebSocket.html), all fetched 2026-12-02. The `Ticker.history` page lists no parameters, so its limits are read from [`scrapers/history.py` at 1.8.0](https://raw.githubusercontent.com/ranaroussi/yfinance/1.8.0/yfinance/scrapers/history.py) (fetched 2026-12-02).

**The streamer's protocol** ([`live.py` at 1.8.0](https://raw.githubusercontent.com/ranaroussi/yfinance/1.8.0/yfinance/live.py), fetched 2026-12-02):

- The client sends JSON text `{"subscribe": [...]}` and `{"unsubscribe": [...]}`.
- The server sends `{"type": "pricing", "message": <base64>}`. The base64 holds a proto3 `PricingData` message ([`pricing.proto`](https://raw.githubusercontent.com/ranaroussi/yfinance/1.8.0/yfinance/pricing.proto), fetched 2026-12-02): `id` 1, `price` 2 (float), `time` 3 (sint64 ms), `last_size` 22, `price_hint` 27. It also declares `bid` 23 and `ask` 25, but no frame Taji measured carries them.
- `AsyncWebSocket` resends the whole subscribed set every 15 s (`live.py:23`). The sync `WebSocket.listen()` loops until interrupted.

**Accounts and entitlements.** There are none. Every caller gets the same answer. Yahoo marks each symbol's delay in `exchangeDataDelayedBy` and `quoteSourceName`. Taji's measured delays are the README's [Stream](https://docs.taji.is/catalog/yahoo.md#stream) and [Quotes](https://docs.taji.is/catalog/yahoo.md#quotes) sections.

**Stated limits.** Yahoo states none.

- yfinance's own docs: a calendar `limit` that "YF caps at 100" (`calendars.py:233`); a screen of at most 250 (`screen`); "Intraday data cannot extend last 60 days" (`scrapers/history.py:123`).
- yfinance's code: 1m defaults to 8 days a request (`:238`), and 1h reaches 730 days (`:242`, `:3043`).

### Offered, not read

What Taji reads, down to each field it fills, is [`docs/reference/coverage/yahoo.md`](https://docs.taji.is/reference/coverage/yahoo.md). What Yahoo serves past that, through yfinance 1.8.0. Yahoo has no plan: every row is keyless. `Ticker`, `Search`, `screen` and the API reference are the [yfinance docs](https://ranaroussi.github.io/yfinance/reference/index.html) pages named above; `ticker.py`, `scrapers/history.py` and `pricing.proto` are read at the 1.8.0 tag.

| Offered | Endpoint | Source, fetched |
|---|---|---|
| A contract's `change`, `percentChange`, `inTheMoney`, `contractSize` and `currency`: `chain_row` reads the book, last, volume, open interest and implied volatility, and `chains` holds no column for the rest (its `multiplier` stays null). Yahoo states no greeks | `query2…/v7/finance/options/{ticker}`, `Ticker.option_chain` | `ticker.py:65-79`, 2026-12-04 |
| A quote's `bidSize` and `askSize` (read, no unit stated, so `bid_size` and `ask_size` stay null) and `quoteSourceName` (read as `source`, used nowhere) | `query1…/v7/finance/quote` | [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html) names no quote field; `yahoo.py` `quotes`, README [Quotes](https://docs.taji.is/catalog/yahoo.md#quotes) |
| The streamer frame's `exchange`, `change`, `change_percent` and `day_volume` (in the frame under Examples) and the rest of `PricingData`: a bid and ask with sizes, open, previous close, day high and low, currency, quote type, market hours, 24-hour volume, an option's strike, expiry and open interest, a coin's supply and market cap. `stream::decode` reads five fields, and no measured frame carries a bid or ask | `wss://streamer.finance.yahoo.com/?version=2` | `pricing.proto`, 2026-12-04 |
| Analyst detail: `analyst_price_targets`' `current`, `high`, `low` and `median`, `recommendations`' counts (`strongBuy` to `strongSell`), each grade change's `firm`, `toGrade`, `fromGrade`, `action`, prior target and target action. `yahoo.py` `analyst` reads them all; `snapshot_rows` keeps the mean target and each change's target. Short interest's `shortPercentOfFloat` is read and dropped the same way | `quoteSummary` via `Ticker.analyst_price_targets`, `.recommendations`, `.upgrades_downgrades`, `.info` | [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html), 2026-12-04 |
| Earnings estimates and surprise: `earnings_history` (`epsEstimate`, `epsActual`, `epsDifference`, `surprisePercent`), and `earnings_estimate`, `revenue_estimate`, `eps_trend`, `eps_revisions`, `growth_estimates` by period (`0q`, `+1q`, `0y`, `+1y`). `earnings` has columns for the surprise and none is filled | `Ticker` properties | [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html), 2026-12-04 |
| Holders and insiders: `major_holders`, `institutional_holders`, `mutualfund_holders`, `insider_purchases`, `insider_transactions`, `insider_roster_holders` | `Ticker` properties | [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html), 2026-12-04 |
| `sec_filings`, `valuation` (nine measures by period), `shares`, `sustainability`, `funds_data` and `isin` | `Ticker` properties (`sec_filings`: `quoteSummary`'s `secFilings`) | [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html), `scrapers/quote.py`, 2026-12-04 |
| Capital gains of a fund or ETF: `Ticker.capital_gains`, and the `Capital Gains` column of `history` | chart, `Ticker.history` | [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html), `scrapers/history.py`, 2026-12-04 |
| `history`'s `2m`, `15m`, `90m`, `5d`, `1wk`, `1mo` and `3mo` intervals: `Interval::of` maps Taji's 1m, 5m, 30m, 1h, 4h and D only, and the hub folds the rest. `Adj Close` and `auto_adjust`, dividends adjusted by Yahoo's own factor: a read answers on one basis ([0007](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0007-vendor-basis-as-given.md)) and `Close` is the split basis | chart, `Ticker.history` | `scrapers/history.py`, 2026-12-04 |
| Trailing (`ttm`) statements (`ttm_income_stmt`, `ttm_cash_flow`), ruled out on 2026-10-28 because the kernel sums quarters itself. `ratios`, ruled out on 2026-10-27: vendor ratios reach `details`, and the kernel computes `kind=ratios` | fundamentals timeseries | [`Ticker`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html), 2026-12-04 |
| The fund and ETF predefined screens (`conservative_foreign_funds`, `top_etfs_us` and eight more; `SCANS` keeps the nine equity ones) and custom `EquityQuery`, `FundQuery` and `ETFQuery` screens. A screened quote's `marketCap` and `exchange` are read and dropped: `screener` has no column for them | `query1…/v1/finance/screener` | [`screen`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.screen.html), 2026-12-04 |
| `Ticker.news`, which answered 404 on 2026-10-27, so news is `yf.Search(...).news`; `Search`'s `lists`, `research` and `nav`; a story's `type`, read and dropped. Market-wide news (`yf.Market`, an empty `Search`) returned no story (probed 2026-10-27) | `query2…/v1/finance/search` | [`Search`](https://ranaroussi.github.io/yfinance/reference/api/yfinance.Search.html), 2026-12-04 |
| `Sector`, `Industry`, `Tickers` and `download`: not yet built | | [API reference](https://ranaroussi.github.io/yfinance/reference/index.html), 2026-12-02 |

Settlement, a volume statistic and per-symbol `status` are not offered: Yahoo states none, or states several that disagree ([README § Options and futures](https://docs.taji.is/catalog/yahoo.md#options-and-futures)).

## Code map

- `plugins/yahoo/taji-plugin.toml`: identity (`id`, `name`, `about`, `free`) and one `[[sources]]` row. It has no `[[link]]`, because nothing is linked.
- `plugins/yahoo/Cargo.toml`: the `test-support` feature (`Client::stubbed`, `Yahoo::over`) for the hub's tests. `tokio-tungstenite` carries the streamer.
- `plugins/yahoo/src/lib.rs`:
  - `Plugin`, which registers `source::Yahoo`;
  - `HOSTS`, the worker's allowed hosts;
  - `Client`, a method per `yahoo.py` call (the rest go through the generic `page`), each bounded by `TIMEOUT` (30 s);
  - the typed answers (`Info`, `Bars`, `Chain`, `Quote` and the rest);
  - the `yahoo.<product>.v1` format names;
  - `parse_bars`.

  Read `Client::page` first.
- `plugins/yahoo/src/yahoo.py`: the only Python. It holds one function per read, each answering plain JSON values. `page` wraps a call as `{"request": [...], "answer": ...}`, and `bars` builds its own pages. The `REACH` and `PIECE` tables bound intraday asks.
- `plugins/yahoo/src/source.rs`, the hub source:
  - `FACTS`, `READS`, `FILLS`, `WORDS`, `KINDS`, `HOTLISTS`, `HEADLINE` and `CAP`;
  - `impl Source for Yahoo`;
  - `spell` and `taji_symbol`, which map symbols both ways;
  - `pages`, `raw_read` and `parse`: the store's raw half;
  - `quote`, `quotes_now`, `forming_day` and `quote_legs`;
  - `open_ticks` and `print`: the stream;
  - `YahooBars`, the `HistoricalData` impl.

  Read `FACTS` first.
- `plugins/yahoo/src/stream.rs`: `Stream`, the process's one streamer socket, with a fan-out per symbol and redial with backoff. `decode` reads the protobuf by hand.
- `plugins/yahoo/src/offer.rs`: `OFFER`, the `data/coverage` audit (as of 2026-10-31).
- `plugins/yahoo/tests/live.rs`: the live suite against Yahoo.
- `plugins/yahoo/scripts/python_gate.sh`: this crate's leg of `engine/crates/taji/scripts/python_gate.sh`.

## How it plugs into Taji

**Traits.** `source::Yahoo` implements `Source` (`engine/crates/taji-plugin/src/vendor/mod.rs`) with these methods:

- `facts`, `seat`, `probe` (always `None`: there is no plan to learn) and `history`;
- `quote`, `quotes_now` (`FACTS.quote_batch` symbols a call), `quote_legs` and `forming_day`;
- `read`, the economic calendar, which is never stored;
- `raw_read`, every stored product;
- `details` and `open_ticks`.

`YahooBars` implements `HistoricalData` (`substrate/taji-brokerage/src/traits/`):

- `get_bars` always refuses, because Yahoo states split-adjusted bars only;
- `get_bars_adjusted` and `get_bars_session` read through `raw`;
- `get_bars_session_raw` hands the hub the raw page to keep;
- `listed` asks `info`;
- `reach_share` is 1.

There is no `VenueReads`, `ExecutionOps`, `ReconcileOps`, `Auth`, `VenueFacts` or `ratelimit.rs`: Yahoo takes no orders and nothing is linked.

**`FACTS`** (`plugins/yahoo/src/source.rs`):

| Field | Yahoo's value |
|---|---|
| `seat` | `Seat::Asked`: seated only when the kernel asks (`Hub::seat_asked`). The kernel asks on every seat of its data plane (`engine/crates/taji/src/trading/mod.rs`, `Plane::seat`), so Yahoo is on unless the setting `data.yahoo` is `false`. |
| `reads`, `fills`, `words` | `READS`, the (class, product, span) triples; `FILLS`, the optional columns its decoders fill per class and product, each held by the decode test of its fixture; and `WORDS`: `kind`, and the screener's `scan`, `list` and `market`. A pair no test decodes a row of is not declared, and `ipos` and `economic` (no class) cannot be. |
| `market_wide`, `unclassed` | Earnings and corporate actions with no `symbols`, off the calendars; `ipos` and `economic` with no class. |
| `kinds`, `hotlists` | `income`, `balance`, `cash_flow`, `float`, `short_interest` and `analyst`; `day_gainers`, `day_losers` and `most_actives` as the gainers, losers and volume hotlists, ranked 4. |
| `own_details`, `details_from` | Its own `details`, from `info`, read at the moment of asking. |
| `sessions` | Equity bars take `session=extended` (yfinance `prepost`). |
| `unranged` | `news`: a capped answer. |
| `now_only` | `search`, `details`, `instrument`, `fundamentals`, `screener`, `ipos` and `statistics`: Yahoo dates none of them. |
| `permits` | `SOCKETS` (16), the gate's default for a vendor that states no concurrency limit. |
| `formats`, `parse`, `rows`, `bars` | The ten `yahoo.*.v1` formats and `yahoo.bars.v1`, each with its parser. |
| `bars_cap` | `CAP`: the classes, Taji's intervals, the `split` basis alone, `CostClass::Free`, `rate_per_min` 0 (unpublished), and the native intervals per class and session. |
| `releases` | `Role::Calendar(HEADLINE)`: Yahoo's names for the kernel's headline economic events. |

**`OFFER`** (`plugins/yahoo/src/offer.rs`) is what `GET /read/data/coverage` shows as `offered_data`. The cells are in the [coverage page](https://docs.taji.is/reference/coverage/yahoo.md).

**Link forms.** None. The manifest has no `[[link]]`: the setting `data.yahoo` (`engine/crates/taji/src/wire/settings.rs`) is the only switch.

**Binding.** `engine/crates/taji-open/src/lib.rs` adds `taji_yahoo::Plugin::default` to the kernel. `Plugin::build` registers the source, and the hub admits `FACTS` at boot (`engine/crates/taji-trading/src/hub/plugin.rs`). On seat, `Yahoo::build` asks the host for a worker confined to `HOSTS` (`Cx::worker` with `WorkerAsk`). With no Python the source stays unseated and its reads answer `not_linked`. The worker starts on the first read, and `Client::get_ready` sets yfinance's cache under the worker's `data/cache`.

**Rank.** Order among providers is the build's `Ties`, in `engine/crates/taji-open/ties/src/lib.rs`:

- `last: &["yahoo"]` puts Yahoo after every other provider in every read but bars;
- `place` 3 puts it after every other bars source;
- `stream` 30 puts it after every pushed stream;
- `economic` lists `yahoo` before `fred`: Yahoo holds the calendar, and FRED values the headline rows.

`engine/crates/taji-trading/src/hub/source.rs` `rank` applies these.

**Surfaces.** Each Taji surface, the vendor call behind it, and the code that makes it. Paths are as `engine/crates/taji-open/tests/vendor_live.rs` asks them.

| Taji surface | Vendor call | Code |
|---|---|---|
| `GET /get/bars?symbols=equity:AAPL&timeframe=D` | `Ticker.history(auto_adjust=False, actions=False, rounding=True[, prepost])` → chart | `YahooBars::raw` → `Client::bars_raw` → `yahoo.py` `bars`; `parse_bars` |
| Today's daily bar while it forms | v7 quote `regularMarket*` | `forming_day`, `day_of` → `yahoo.py` `quotes` |
| `GET /get/quotes?symbols=equity:AAPL,equity:MSFT` | v7 quote: `regularMarketPrice`, `regularMarketTime`, the book | `source.rs` `quotes_now`, `quote_pair` → `yahoo.py` `quotes` |
| `GET /get/quotes?symbols=option:<OCC>`, chain legs | `option_chain(expiry)` row | `option_quote`, `quote_legs`, `expiry_rows` → `yahoo.py` `chain` |
| Live `trades` and `quotes` on `/ws/market` | streamer `subscribe` | `open_ticks`, `print` → `stream::Stream::subscribe` |
| `GET /get/chains?symbols=equity:AAPL` | `Ticker.options`, then `option_chain` per expiry | `chains_raw` → `yahoo.py` `chain` (or `expiries` on `strikes=0`) |
| `GET /get/details` | `Ticker.info` | `source.rs` `details`, `details_row` → `yahoo.py` `info` |
| `GET /get/instrument` | `Ticker.info` identity keys | `pages` → `yahoo.py` `listings` |
| `GET /get/fundamentals?kind=income` (`balance`, `cash_flow`) | `get_income_stmt(pretty=False, freq=...)` and siblings → timeseries | `pages` → `yahoo.py` `statements`; `fundamentals_rows` |
| `kind=float`, `short_interest`, `analyst` | `Ticker.info`; `analyst_price_targets`, `recommendations`, `upgrades_downgrades` | `yahoo.py` `info`, `shorts`, `analyst` |
| `GET /get/corporate_actions?symbols=…` | `Ticker.dividends`, `.splits` | `yahoo.py` `actions`; `corporate_actions_rows` |
| `GET /get/earnings?symbols=…` | `get_earnings_dates(limit=100)`, `Ticker.calendar`, then `actions` | `yahoo.py` `earnings`, `actions`; `earnings_rows` |
| `get/earnings`, `get/corporate_actions` without `symbols`; `GET /get/ipos` | `Calendars.get_earnings_calendar`, `get_splits_calendar`, `get_ipo_info_calendar` | `calendar_pages` → `Client::calendar_pages` → `yahoo.py` `calendar` |
| `GET /get/economic` | POST visualization, `entityIdType: economic_event` | `source.rs` `read` → `Client::economic` → `yahoo.py` `economic` |
| `GET /get/news?symbols=…` | `yf.Search(symbol, news_count≤25).news` | `yahoo.py` `news`; `news_rows` |
| `GET /get/search?class=equity&search=apple` | `yf.Search(text).quotes` | `yahoo.py` `search`; `search_rows` |
| `GET /get/screener?class=equity&scan=day_gainers` | `yf.screen(name, count=250)` | `yahoo.py` `screen`; `screener_rows` |
| `GET /get/statistics?symbols=future:ESZ26` | `Ticker.info` `openInterest` | `yahoo.py` `open_interest`; `statistics_rows` |

**One read, end to end.** Take `GET /get/bars?symbols=equity:AAPL&timeframe=D` with no linked bars source:

1. `engine/crates/taji/src/wire/data.rs` hands the read to the hub, which ranks the seated sources (`rank`) and asks Yahoo's `Source::history` for `YahooBars`.
2. For each window it lacks, the hub takes Yahoo's gate (`Hub::gate`) and calls `get_bars_session_raw` (`engine/crates/taji-trading/src/hub.rs`).
3. `YahooBars::raw` refuses any basis other than `split`, and a future's 4h. It spells `AAPL` (`spell`), then calls `Client::bars_raw`, which refuses `prepost` at 1h and 4h.
4. `Client::call` runs `yahoo.py`'s `bars` on the worker within 30 s. `bars` asks `Ticker.history` once for daily bars, or in `PIECE`-sized windows within `REACH` for intraday.
5. The worker answers JSON text holding the bars, `price_hint`, `session_end`, `session_day`, and a `request` record of each `history` call.
6. The hub keeps that text as `Raw { format: "yahoo.bars.v1" }`. `FACTS.bars` (`parse_bars`) reads it: prices are rounded to `priceHint`, bars outside the span are dropped, and a daily bar whose session has not closed is dropped.
7. The kernel answers the OHLCV rows with `provider: "yahoo"`.

A replay re-reads the kept pages through the same `parse_bars`.

**One live stream, end to end.** A `/ws/market` subscription to `equity:AAPL` trades, with no faster stream linked, reaches `open_ticks`:

1. `open_ticks` refuses a continuous future with `NoContinuous`. The hub then asks which dated contract it trades as and streams that contract under the continuous name (`engine/crates/taji-trading/src/hub/contracts.rs`, `traded`).
2. It spawns a task on `Stream::subscribe("AAPL")`. The first subscription opens the socket and sends `{"subscribe":["AAPL"]}`.
3. Each `pricing` frame is decoded (`stream::decode`) and fanned out by `id`.
4. `print` rounds the price to `price_hint`, drops a repeated (`time`, `price`), and drops the size of a coin, which is its day volume. It sets `delayed` when `time` is over 60 s behind receipt.
5. The task sends `TickEvent::Trade`. When the socket ends for good, the task sends `TickEvent::Lapsed`.

Every 5 s, the socket releases the symbols no consumer holds. Once no symbol is held, it closes.

## Why it is built this way

- **yfinance in a worker, not Rust HTTP.** Yahoo publishes no API. yfinance owns the cookie, crumb and consent handshake and every page's parsing, and it is pinned (`yfinance==1.8.0` in `substrate/taji-python/requirements.lock`). The user ruled for one pinned version, never self-updating (2026-11-15). A provider whose library is Python runs it in its own confined process ([provider guide](https://docs.taji.is/plugins/provider.md), step 3). `python_gate.sh` (d) asserts that the kernel links no Python library.
- **The stream in Rust.** yfinance's sync `listen()` never returns, and the worker's Python thread serves one bounded call at a time (`plugins/yahoo/src/stream.rs` header). One socket serves the whole process, and each symbol is one fan-out.
- **Last in every rank.** Yahoo is unofficial (comments in `engine/crates/taji-open/ties/src/lib.rs`). The user ruled on 2026-10-27 that Yahoo is a provider like any other, in Massive's shape, ranked last, and that a real-time Yahoo stream never leads a linked delayed feed.
- **Split basis alone.** One basis per read, as the vendor gives it ([0007](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0007-vendor-basis-as-given.md)). `Close` is split-adjusted, and `Adj Close` uses Yahoo's own dividend factor. A restated dividend or EPS is served as given and flagged `split_restated` (README [Corporate actions](https://docs.taji.is/catalog/yahoo.md#corporate-actions)).
- **The kernel computes.** Greeks and the mid of a chain are the kernel's, not Yahoo's ([0001](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0001-kernel-computes.md)). `chain_row` carries no greeks, and Yahoo's `impliedVolatility` passes through as `iv`.
- **No vendor shape reaches a client.** Yahoo's answers become hub products (`bars`, `chains`, `fundamentals` lines on EDGAR's concepts, and so on) ([0004](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0004-capabilities-through-the-hub.md)). A screen becomes a hotlist (`HOTLISTS`), not a Yahoo route.
- **Raw pages kept, parsed twice.** Each stored product keeps Python's JSON with a `request` record per yfinance call (never a secret: there is none). A live read and a replay go through one `parse`. A chain also keeps the instant its last call answered, which no Yahoo answer states.
- **Refuse rather than guess.** An empty answer is checked with `info`. With no `exchangeTimezoneName`, Yahoo does not list the symbol, and the read is refused `not_listed` (`refuse_unlisted`). With one, the empty answer is real.
- **Whole calendar days.** A calendar day still full after 20 pages of 100 is refused. Yahoo orders a day by market cap, so a cut day would silently lose its smallest names (`Client::calendar_pages`).
- **`delayed` derived.** On the stream, `delayed` means `time` is more than 60 s behind receipt, never `exchangeDataDelayedBy`. AAPL's stream measured real time while that field said 15. This follows Schwab's per-tick flag (README [Stream](https://docs.taji.is/catalog/yahoo.md#stream)). A snapshot quote still uses `exchangeDataDelayedBy > 0`.
- **Refusals before a request.** A future's 4h counts from a UTC grid, not the Globex open, and 1h or 4h with `prepost` breaks at 09:30. Both are refused before any call, naming the fold to use instead. Option bars are narrowed to 1m and D in `CAP`, because a native 5m or 30m answers empty and the store would keep that empty answer.

## Constraints and limits

- **Concurrency.** The hub's gate for Yahoo holds `SOCKETS` (16) permits, but the worker runs one call at a time per lane on one Python thread. `reach_share` is therefore 1, and further chunks queue. Each call is bounded by `TIMEOUT` (30 s), including the first one, which imports yfinance. No rate budget exists: Yahoo publishes none, and no 429 has been reproduced. A 429 surfaces as yfinance's `YFRateLimitError`, which reaches Taji as a vendor error. The numbers are in the README's [What Taji calls](https://docs.taji.is/catalog/yahoo.md#what-taji-calls).
- **Bar reach.** `REACH` and `PIECE` in `yahoo.py`:
  - 1m reaches 30 days back, asked in 7-day pieces;
  - 5m and 30m reach 60 days in one request;
  - 60m and 4h reach 730 days;
  - an ask past the reach is clamped, and a span entirely past it gets no bars.

  Measured volumes and native-versus-fold differences are in [Bars](https://docs.taji.is/catalog/yahoo.md#bars).
- **Stream.** Prints only, with no book. A continuous future and an option send nothing. A frame repeats about one print in four. See [Stream](https://docs.taji.is/catalog/yahoo.md#stream).
- **Symbology.** `spell` maps Taji's spellings to Yahoo's:

  | Taji | Yahoo |
  |---|---|
  | `BRK.B` | `BRK-B` |
  | `BTC/USD` | `BTC-USD` |
  | `EUR/USD` | `EURUSD=X` |
  | `$SPX` | `^GSPC`, from `engine/crates/taji-plugin/listings/indices.csv`; the chain lists under `^SPX` |
  | `ESZ26` | `ESZ26.CME`, by exchange suffix: CME, CBT, NYM or CMX |
  | `@ES` | `ES=F` |
  | an OCC option | unchanged |

  `taji_symbol` reverses the mapping and drops what Taji cannot spell, such as `AAPL.TO`. A CFE future has no spelling.
- **Refusals.** These are the refusals Yahoo's reads raise:
  - `NoSource`: a product, kind, interval or symbol Yahoo has no spelling for;
  - `NotListed`: Yahoo does not list the symbol;
  - `NoContinuous`: a continuous future on the stream;
  - `Provider("yahoo states split-adjusted bars alone")`: any basis other than `split`.
- **Entitlement.** There is none to learn: `probe` returns `None`, and the hub keeps no grants for Yahoo.
- **Terms.** Yahoo's terms forbid automated access, as quoted under The vendor. `OFFER`'s comment records it, and the README's References link the terms.

## Examples

**A streamer frame.** This is a frame shaped as Yahoo's, its figures made up, in `plugins/yahoo/src/stream.rs`, in `a_dropped_stream_redials_and_resubscribes`:

```json
{"type":"pricing","message":"CgRBQVBMFQAAyUIY0Jyh6a9oKgNOTVMwCDgBRQAAAD9I0A9lAAAAP7ABKNgBBPUCAAAAP/0CAAAAPw=="}
```

Decoded against `pricing.proto`, it holds `id` "AAPL", `price` 100.5 (float32), `time` 1793125001000, `exchange` "NMS", `change_percent` 0.5, `day_volume` 1000, `change` 0.5, `last_size` 20 and `price_hint` 2. It holds no `bid` or `ask`. The client's subscribe for it is `{"subscribe":["AAPL"]}`, which the same test asserts on both connections. `print` turns such a frame into a trade rounded to two decimals, `delayed: false` (`a_streamed_frame_is_a_print_once` in `plugins/yahoo/src/source.rs`).

**A request record.** This is what a stored page carries for each yfinance call. It is recorded in `a_page_is_pythons_json_and_the_call_it_made` (`plugins/yahoo/src/lib.rs`) over a stub yfinance:

```json
{"method": "yfinance", "url": "actions", "params": {"symbol": "AAPL"}}
```

**A quote becomes the forming day.** A `Ticker.info` shaped as SPY's read on 2026-10-30 at 18:43 ET, its figures made up, is in `a_quotes_regular_market_is_the_forming_day_only_on_its_session` (`plugins/yahoo/src/source.rs`). It holds `regularMarketTime` 1793390400 (16:00 ET), `priceHint` 2, open 500.0, high 505.5, low 495.5, price 500.5 and volume 1000000. `day_of` makes it the 10-30 daily bar (time 1793318400) at those figures, `as_of` 1793390400, provider `yahoo`. The next morning's pre-market returns no day.

**The kernel's answer about Yahoo.** This is from `GET /read/data/coverage`, recorded in `engine/crates/taji/tests/fixtures/wire/data-coverage.json` (Yahoo's equity row, trimmed):

```json
{
 "adjustments": ["split"],
 "class": "equity",
 "cost": "free",
 "intervals": ["1m", "5m", "30m", "1h", "4h", "D"],
 "kinds": ["income", "balance", "cash_flow", "float", "short_interest", "analyst"],
 "linked": true,
 "provider": "yahoo",
 "rate_per_min": 0,
 "reads": {
  "history": ["bars", "details", "instrument", "screener", "corporate_actions", "earnings", "news", "search", "fundamentals"],
  "live": ["quotes", "trades"],
  "more": ["bars session=extended", "fundamentals kind"],
  "realtime": ["quotes"]
 },
 …
}
```

**A bars, quotes or economic read through the wire.** No capture yet. The `bars`, `quotes` and `economic` steps of `engine/crates/taji-open/scripts/vendor_live.sh yahoo` make one, as do `bars_daily` in `plugins/yahoo/tests/live.rs` and `engine/crates/taji-open/scripts/economic_walk.py <port> unlinked`. None writes its answer to a fixture today.

## Testing

| What | Command | Needs |
|---|---|---|
| Offline unit tests: mapping, parsing, spelling, the stream's redial over a local socket | `cargo test -p taji-yahoo --lib` | nothing |
| Python tests: `yahoo.py` over a fake yfinance on `Worker::direct` | `cargo test -p taji-yahoo --lib -- --ignored`, or `engine/crates/taji/scripts/python_gate.sh` (it sources `plugins/yahoo/scripts/python_gate.sh`) | `make setup` (`.python`) |
| Live suite against Yahoo: info, bars, actions, earnings, chains, search, quotes, an unknown symbol, fundamentals, economic, calendars, native 60m and 4h | `cargo test -p taji-yahoo --test live -- --ignored --test-threads=1 [filter]` | Python, network; no key |
| Every Yahoo read over the wire on a scratch kernel | `engine/crates/taji-open/scripts/vendor_live.sh yahoo` | Python, network; no key |
| Forex bars through `hub::serve` | `cargo test -p taji-open --test yahoo_forex_live -- --ignored --nocapture --test-threads=1` | Python, network |
| Native tiers against the 1m fold | `cargo test -p taji-open --test tier_native_live -- --ignored --nocapture --test-threads=1` | Python; the other vendors' keys for their legs |
| The economic walk | `engine/crates/taji-open/scripts/economic_walk.py <port> unlinked`, against a headless kernel on scratch dirs | Python, network |

Every test reads Yahoo only: there is no order, and no paper or SIM. The hub's own tests in `taji-trading` seat Yahoo through `Client::stubbed` and `Yahoo::over` (feature `test-support`). A fresh test kernel sets `data.yahoo` to `false`, so no other suite depends on Yahoo (`engine/crates/taji-open/tests/kernel/mod.rs`).

## References

All fetched 2026-12-02.

- Yahoo Terms of Service: https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html
- yfinance repository and disclaimer: https://github.com/ranaroussi/yfinance
- yfinance on PyPI (1.8.0, uploaded 2026-11-03): https://pypi.org/project/yfinance/
- yfinance API reference: https://ranaroussi.github.io/yfinance/reference/index.html
- `Ticker`: https://ranaroussi.github.io/yfinance/reference/api/yfinance.Ticker.html
- `Search`: https://ranaroussi.github.io/yfinance/reference/api/yfinance.Search.html
- `Calendars`: https://ranaroussi.github.io/yfinance/reference/api/yfinance.Calendars.html
- `screen`: https://ranaroussi.github.io/yfinance/reference/api/yfinance.screen.html
- `WebSocket`: https://ranaroussi.github.io/yfinance/reference/api/yfinance.WebSocket.html
- yfinance 1.8.0 source, cited by file and line above: https://github.com/ranaroussi/yfinance/tree/1.8.0/yfinance (`data.py`, `live.py`, `pricing.proto`, `const.py`, `calendars.py`, `search.py`, `ticker.py`, `scrapers/history.py`, `scrapers/fundamentals.py`, `scrapers/quote.py`, `screener/screener.py`)
- Measured behaviour: [README](https://docs.taji.is/catalog/yahoo.md); cells: [coverage](https://docs.taji.is/reference/coverage/yahoo.md); the data plane: [data architecture](https://docs.taji.is/architecture/data.md)
