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

# Schwab

Your Schwab brokerage account, reached through your own Trader API app: orders and market data.

## Before you link

You need your own Trader API – Individual app (its client ID and client secret) with both products approved, then a sign-in in your browser every 7 days.

### Access

- A Schwab brokerage account is required (P, G `individual-developer/about-individual-developer-role`). Design choice: each user brings their own **Trader API – Individual** app's key and secret, reaching only their accounts (P, G-ind). It needs Accounts and Trading Production and Market Data Production, else 401 `Client not authorized` (S, SD docs/troubleshooting.md:5-7).
- A callback change re-enters review (P, G `requesting-product-access`; S, PY docs/auth.rst:261-280).
- Strip whitespace from a pasted key or secret (S, SB docs/auth.rst:290-300).
- Grant: `authorization_code` only (P, G-cb), at `/v1/oauth/authorize?client_id&redirect_uri&response_type=code&state` (S, PORTAL `oauth.md:114`, RS `oauth.rs:35-38`). The redirect carries a single-use `code`, URL-encoded, ending `%40` (S, PORTAL `oauth.md:116-125`).
- Lifetimes: access 30 min, refresh 7 days (S, PORTAL `oauth.md:81-112`), **counted from the code exchange; a refresh does not extend them** (S, PY `auth.py:56-58`, SD `tokens.py:320`, RS `oauth.rs:279`). A refresh answers a `refresh_token`; the old one works all week; store the new (S, SD `tokens.py:216`).
- A dead refresh token answers 400 `unsupported_token_type` with a nested `invalid_grant` (S, SB `auth.rst:355-366`, measured) or, past its seven days, `invalid_client` (S, PY docs/auth.rst:188-193, 334-341), a superseded one a nested `refresh_token_authentication_error` (S, SD issue 40): the browser consent again. A password change, revoke or aborted re-authorize kills it too (P, G-refresh).
- Callback: HTTPS, matched byte for byte, several comma-separated in 255 characters; `https://127.0.0.1` allowed (S, PORTAL `oauth.md:46-50`). Clients want `127.0.0.1` with a port, never `localhost` (S, PY `auth.py:249-259`, SB `getting-started.rst:81-90`).
- Re-sign-in at the 7-day end is a person's (S, PY `auth.py:568`, SB `auth.rst:47-54`).
- **No paper account, no sandbox** (P, G `test-in-sandbox`; PORTAL `oauth.md:55`): the first order is real money.

## Link

Start `schwab` from Connections in the window, or run `taji-link schwab`. It takes your app's client ID, client secret and callback URL, which Taji seals in the vault, then you sign in in your browser. Schwab has no paper account: every order is real money, and the order path has not been run against Schwab.

### Linking

Controls are third-party transcriptions of the portal (S), each cited; what only Schwab's page could source is "unsourced".

| Step | Page and controls | Needs |
|---|---|---|
| `developer` | https://developer.schwab.com, "create a developer account"; sign in; choose the Individual Developer role (S, https://schwab-py.readthedocs.io/en/stable/getting-started.html, whose link, `beta-developer.schwab.com`, no longer resolves). Role needs a Schwab brokerage account (P, above). Its fields, and whether the login is the brokerage one: unsourced | yours: a login, and a code if asked (unsourced) |
| `app` | https://developer.schwab.com, "API Products" > "Trader API - Individual" box > "Request Access" (S, https://wealth-lab.com/Discussion/Schwab-broker-extension-Beta-release-11565). Then Dashboard > Apps > "Create App": "API Product" dropdown (S, schwab-py: "Accounts and Trading Production" or "Market Data"; the products above want both), "Order Limit" (120), "App Name", "Description", "Callback URL" (`https://127.0.0.1:8182`, no trailing slash, matched exactly), then "Submit" (S, https://nango.dev/docs/api-integrations/schwab/how-to-register-your-own-schwab-oauth-app) or "Create" (S, schwab-py): unreconciled. The route is unsourced (schwab-py's `/dashboard/apps/apps/add` sat on the dead host) | none: the agent may |
| `review` | Dashboard > Apps, the app's status: "Approved - Pending", then "Ready For Use"; "App Registration Error" (S, schwab-py). "Client ID" and "Client Secret" sit under "App Details" (S, nango; unsourced whether before "Ready For Use") | none: a wait |

Schwab's stated review time is about two business days (P, G `requesting-product-access`). Others: "up to a few days" (S, schwab-py); "a couple days", "up to a month", a Schwab representative's "after the next overnight sync" (S, wealth-lab thread).

## What you get

Your Schwab accounts and their price history: the window shows them, and your agent reads your balances, positions and orders and Schwab's price history. What it serves, cell by cell: [Schwab coverage](https://docs.taji.is/reference/coverage/schwab.md).

## Behaviour and limits

P = Schwab's own page; S = community; U = inferred; M = measured. `G-*` = `developer.schwab.com` guides; `ARCH` = `archive.org/details/schwabtraderapi` (Schwab's docs, 2024-04-08, S); `PORTAL` = `pashpashpash/schwab-cli` docs/schwab-api/*.md, the portal transcribed 2026-05-04 (S). Clients: `PY` = `alexgolec/schwab-py`, `SD` = `tylerebowers/Schwabdev`, `SB` = `tom-hirt/schwaby` (labels its claims measured), `RS` = `major/schwab-rs`, `ZW` = `z-Wind/schwab_api`. Schwab's API specs redirect to `/login`; `RS` docs/{trader_api,market_data}.openapi.json copy them (S).

### Transport and limits

- Idle close (M, 2026-10-31): a connection lives 420 s, dropped by 600 s; the order arm's client is warmed every 300 s as the data client is.
- Orders: 0–120 PUT/POST/DELETE a minute per account, set at registration; GETs unthrottled (S, PORTAL `order-examples.md:7`). No REST concurrency limit is published (reread 2026-10-31); the hub's gate holds 16 calls at once. `/quotes` answers 429 without `Retry-After` (S, SB `client.rst:378-388`, measured).
- One process owns a token: two refreshing one sign-in lock one out (S, PY `auth.rst:353-357`). Streamer: `userPreference.streamerInfo[0]` names the socket (S, PY `streaming.py:193-391`). One stream session for each login: a second login ends the first, code 12 (S, SB `streaming.rst:57-70`).

### Data

Offered: `data` in `src/offer.rs` and `docs/reference/coverage/schwab.md`; what it serves past that is [Offered, not read](https://docs.taji.is/catalog/schwab/architecture.md#offered-not-read). No time-and-sales stream: level one carries the last print only (S, PORTAL; owner, 2026-12-03). `/quotes` takes ≤500 symbols; `/markets` serves today to +1 y; equity depth is per-MPID entries, no order count.

- `pricehistory` (S, PORTAL `market-data-rest.md:117-147`, SD `validation.py:21-26`): `periodType` day, month, year or ytd, each with its frequencies; `startDate`/`endDate` epoch ms (no `endDate`: last close); `needExtendedHoursData`. A candle is stamped at its open (S, SB `client.rst:339-354`). `fetched` (`engine/crates/taji-trading/src/hub.rs`) asks 5 and 30 native for equity, unprobed against the 1m fold (no linked token, 2026-10-31; served as given).
- Bars by class (M, 2026-11-02): `$SPX`, `/ESZ26`, `/ES` (the dated front's candles) and a padded OCC answer `pricehistory` at 1m, 5m, 15m, 30m and daily; an index candle has volume 0, and an answer can run past `endDate`. 1m reaches 48 days for equity, index and option, a future its last 40,000 candles (`/ES` 41 days; 5m 206, 30m 260). Daily starts: equity 1984-11-01 (AAPL 1985-01-02), `$SPX` 1950 or earlier (a `startDate` before 1970 is a 400), a future its root's first day (`/ES` 1983-02-01), an option its listing, with minutes that traded only; an expired contract is empty.
- Index: `/quotes` on `$SPX` answers (M, 2026-10-29), as does `LEVELONE_EQUITIES` (M, 2026-11-02, a first frame): its bid and ask are a 100-point band of size 0 and NUL ids, read as no book. `CHART_EQUITY` on `$SPX`: `SUBS` accepted, no row in 3 minutes, AAPL's each (M, 2026-11-02). Forex and crypto: unprobed or none.
- No `fundamentals` kind: the `fundamental` projection fits none (no statements, unmeasured units); `details` reads it (2026-11-19).
- Future-option chains are refused, per Schwab support. `/{symbol}/quotes` breaks on `/ES`, `/quotes` serves it (S, PY `base.py:459-462`).
- Each `/quotes` entry says `realtime` true or false, by the login's entitlement (S, ZW `tests/model/MarketData/QuoteResponse_real.json`, PY docs/client.rst:351); `userPreference.offers[].mktDataPermission` reads `NP` in every sample, a subscriber class, not the tier. Measured on a non-professional (NP) login (M, 2026-10-29): LOGIN `status=NP`; every streamer service answered `SUBS code=0`, real-time. `/quotes` AAPL, `$SPX`, `/ESZ26`, an AAPL call: `realtime=true`, `quoteType` `NBBO` on equity only; /ES keyed `/ESZ26`. `/chains` has no `entitlement` response field, `isDelayed=false`; futures options spell `./ESZ26C7700`. Not-entitled answer: unmeasured.
- A `CHART_EQUITY` row lands ~3 s past its minute in RTH, ~2 s after hours; its float `VOLUME` misses whole shares on 24 of ~90 TSLA minutes (M).
- A future's daily candle closes on its last print at 17:00 ET, not the settlement: `/NQZ26` 2026-11-03, `closePrice` and `reference.futureSettlementPrice` differ, the settlement CME's by Databento (M, 2026-11-04).
- No read lists a root's contracts. `/quotes` answers a listed month (`/NQH27`, with `reference.futureExpirationDate`, `futureIsActive`) and sends none for an unlisted one (`/NQF27`, `/NQX26`, `/NQZ30`, M, 2026-11-04).
- `pricehistory` answers a future's front whichever month is asked (M, 2026-11-04: `/NQH27`, `/NQZ27` the candles of `/NQZ26`, whose `/quotes` differ): `SchwabBars` refuses a month `reference.futureIsActive` calls inactive, for Yahoo's.

### Orders

**Order entry covers equities and options; futures are data only** (S, ARCH ~2760; a 2026 third party, `mylinedchart.com`). Enums: PY `common.py`; the classes offered are `trades` in `src/offer.rs`.

- No client id: `tag` is server-set (`TA_…`), not in `OrderRequest`; a duplicate POST places twice; lookup is by `orderId` or listing (D, github.com/major/schwab-rs docs/trader_api.openapi.json, read 2026-11-02).
- A one-leg option order's read says whether it opens or closes, off its `OptionInstruction` (`BUY_TO_OPEN` and the rest); an equity's says neither, and a spread's read states no single order.
- No body or meaning anywhere: strategies CANCEL, RECALL, PAIR, FLATTEN, TWO_DAY_SWAP, BLAST_ALL; order types CABINET, NON_MARKETABLE, EXERCISE; SELL_SHORT_EXEMPT; the fund-only fields.
- Replace: "Once replaced, the old order will be canceled and a new order will be created" (Trader API spec, via `RS`, S). Nothing documents replacing one child of a TRIGGER or OCO or the new order keeping its link, and a child that lost it would let both exits fill: a group's members and a spread are not replaced (`NotInPlace`), single orders by `PUT`. The listing fills a group member's `price` and exit `tranche` and says why in `Asked.fixed`; an order with a member marked `editable: false` is not replaced either.
- A replace's `PUT` is built from the order's read: every field it was placed with, the route off `requestedDestination` (never the `destinationLinkName` it was routed to). An order the read cannot rebuild (a trailing stop limit with no `priceOffset`, which Schwab's order schema lacks) or one filled in part is `NotInPlace`, nothing sent. A `PUT` answered without the new id adopts the one the old order's `replacingOrderCollection` names, else the one new order of the body's shape the listing shows, else is `AckedUnconfirmed` (U: neither field measured).

### Symbology and gotchas

- Options are OCC-padded: `XYZ   210115C00050000` (S, ARCH ~2770-2790). Any `/authorize` restart kills the current access token (P, G-refresh).

## Open

- Whether futures order entry is still refused; the measured `expires_in` and refresh-token life.
- Market-data rate limits; streamer caps per service and login; whether `mktDataPermission` is ever other than `NP`.
- `previewOrder`'s answer to each order word; the screener stream's rows; level one's trade cadence in RTH; option sessions, and TIF or kind limits per class.
- When `/NQ`'s quoted contract rolls (Databento's: after the expiring day).
- A venue-held protective (`TRIGGER`, `OCO`): `protection()` declares none; exit plans are supervised. Commissions and market-data fees (no price page fetched).
- Whether a replace of an order filled in part creates its whole `quantity` or the remainder: the spec says neither, so it is refused and a chase holds its price, asking again each interval. A fill between the order's read and the `PUT` lands under either answer. Whether a read lists `priceOffset` and `replacingOrderCollection`.

## References

- Portal (shown only to a signed-in browser; read 2026-12-02): https://developer.schwab.com/products/trader-api--individual
  - [Accounts and Trading Production](https://developer.schwab.com/products/trader-api--individual/details/documentation/Retail%20Trader%20API%20Production?docId=retail-trader-api-production--trader-api--individual--documentation) and [its specification](https://developer.schwab.com/products/trader-api--individual/details/specifications/Retail%20Trader%20API%20Production)
  - [Market Data Production specification](https://developer.schwab.com/products/trader-api--individual/details/specifications/Market%20Data%20Production) and [its documentation, the streamer](https://developer.schwab.com/products/trader-api--individual/details/documentation/Market%20Data%20Production?docId=market-data-production--trader-api--individual--documentation)
- A local copy of the portal's streamer page lives outside git, as it is Schwab's copyright: the checkout reaches it at `data/vendor-docs/schwab`, with a `MANIFEST.tsv` of its source, fetch time and hash. For the REST APIs, [schwab-py's docs](https://schwab-py.readthedocs.io/en/stable/) stand in for the portal's specifications (user, 2026-12-02).
- How the integration works, and why: [Schwab: how it works](https://docs.taji.is/catalog/schwab/architecture.md)
