Skip to main content

Schwab: how it works

Charles Schwab's Trader API is Taji's live brokerage for a Schwab account and one of its market-data sources. Taji reaches it through the user's own Trader API – Individual app. From it Taji takes balances, positions and orders on every account the sign-in reaches; equity and option order entry; and pricehistory bars, point quotes, option chains, movers, instrument search and details, and streamed 1m bars, level-one quotes, books and account activity. The shape is one compiled-in crate, taji-schwab (plugins/schwab/). It is a data source and a live-only venue on one OAuth sign-in, and it talks to two hosts: api.schwabapi.com for REST and the token endpoint, and the streamer host that userPreference names (streamer-api.schwab.com today, HOSTS in plugins/schwab/src/lib.rs).

The vendor​

Schwab's developer portal (developer.schwab.com) shows its pages only to a signed-in browser. Every vendor fact below comes from one of four places:

  • The portal, read signed in on 2026-12-02: the Accounts and Trading Production documentation (OAuth, order samples, the order throttle) and its OpenAPI specification, and the Market Data Production specification and documentation (the streamer). A local copy, outside git, is described on the plugin page.
  • The Market Data specification as major/schwab-rs copies it (its market_data.openapi.json, a community copy of the portal's, fetched 2026-12-04): the fields of each REST answer, named below as OpenAPI.
  • schwab-py: Alex Golec's client library and its docs, for what the portal does not say.
  • Measured: the measured lines of the plugin page.

Each source is labelled where it is used, and every link was fetched 2026-12-02 but the specification copy.

Hosts and environments.

Auth model.

  • The grant is authorization_code, run in the user's browser on Schwab's Login Micro Site, where the user consents and picks accounts. The code is exchanged, and every refresh is sent, as POST /v1/oauth/token with Authorization: Basic base64(client_id:client_secret) and a form body. There is no PKCE.
  • The callback must be HTTPS and is matched byte for byte. https://127.0.0.1 is allowed (portal, Accounts and Trading), with a port (schwab-py auth, which recommends https://127.0.0.1:8182).
  • The access token lives 30 minutes (expires_in: 1800). The refresh token lives 7 days from creation. A refresh does not extend those 7 days; after them, or after a password reset, the browser consent must run again (portal, Accounts and Trading; schwab-py).
  • schwab-py warns that two holders of one token race each other's refreshes and lock one out.
  • The token answer also carries id_token, scope: "api" and token_type: "Bearer".

API families Taji calls.

  • Accounts and Trading (portal, Accounts and Trading spec):
    • GET /accounts/accountNumbers, which maps each account number to the hashValue every account path takes;
    • GET /accounts/{hash}?fields=positions;
    • GET /accounts/{hash}/orders, which needs fromEnteredTime and toEnteredTime, spans at most one year, and defaults maxResults to 3000;
    • GET, PUT and DELETE /accounts/{hash}/orders/{id};
    • POST /accounts/{hash}/orders and POST /accounts/{hash}/previewOrder;
    • GET /userPreference.
  • Market Data (portal, Market Data spec): /quotes, /chains, /expirationchain, /pricehistory, /movers/{index}, /instruments and /instruments/{cusip}, /markets and /markets/{market}.
    • pricehistory takes periodType, frequencyType, frequency (minute 1, 5, 10, 15 or 30) and startDate/endDate in epoch milliseconds.
  • Streamer (portal, Streamer; schwab-py streaming): one WebSocket. ADMIN/LOGIN presents the access token; then SUBS, ADD and UNSUBS are sent per service, with numeric field keys.
    • Response code 3 is LOGIN_DENIED, which asks the client to log in again with a new token.
    • Code 12 is CLOSE_CONNECTION: "A limit of 1 Streamer connection at any given time from a given user is available".
    • Code 19 is REACHED_SYMBOL_LIMIT, with no number stated.
    • CHART_EQUITY fields: the portal's table puts Open–Volume at 1–5 and Sequence at 6, while schwab-py's ChartEquityFields (read 2026-12-02) puts SEQUENCE at 1 and OHLCV at 2–6. stream.rs follows schwab-py, and the measured chart rows agree.
  • Order samples (portal, Accounts and Trading): order entry covers equities and options only. OCC option symbols are padded to a six-character root (XYZ 210115C00050000).

Accounts and entitlements.

  • An app subscribes to one API product (portal, Accounts and Trading). Taji's is Trader API – Individual, whose Accounts and Trading Production and Market Data Production APIs it calls (plugin page, Access).
  • Account numbers never appear in a path: the hash does.
  • Each /quotes entry says realtime true or false, set by the login's market-data entitlement (schwab-py client: "delayed-quote accounts receive delayed quotes").

The vendor's stated limits.

  • Order writes (PUT, POST, DELETE) are throttled per account, at a ceiling set at registration from 0 to 120 a minute. Order GETs are unthrottled (portal, Accounts and Trading).
  • No market-data or REST concurrency limit is published.
  • One streamer connection is allowed per user.

Vendor capabilities Taji does not use, and why.

  • Futures and forex orders. Schwab takes none: order entry is EQUITY and OPTION only (portal, Accounts and Trading). orders::order_body refuses every other class before any HTTP.
  • Option exercise. No source shows its body, so ExecutionOps::exercise refuses (plugins/schwab/src/orders.rs DEFERRED).
  • The order enum members no source gives a body or a meaning for (strategies CANCEL, RECALL, PAIR and others; order types CABINET, NON_MARKETABLE): they are listed in DEFERRED and FIELDS_DEFERRED with each one's reason.
  • The sandbox. It does not exist.
  • /accounts/{hash}/transactions and GET /orders across all accounts. Not yet built.
  • /{symbol}/quotes. It breaks on futures symbols such as /ES (schwab-py), so every quote goes through /quotes. market::quote keeps the path for the live suite.
  • The futures, forex and futures-options books. schwab-py reports they refuse to connect.

Offered, not read​

What Taji reads, down to each field it fills, is docs/reference/coverage/schwab.md. What Schwab serves past that, every row on Market Data Production, which any Trader API – Individual app holds (the login's entitlement sets only whether a quote is real-time). OpenAPI is the specification copy above, Streamer the portal's streamer page (doc, read signed in 2026-12-02, local copy per the plugin page).

OfferedEndpointSource, fetched
A chain contract's theoreticalOptionValue (a theo column exists) and lastTradingDay (last_trade_at): chain_rows drops bothGET /chainsOpenAPI OptionContract, 2026-12-04
A chain contract's bidSize, askSize, lastSize, day openPrice, highPrice, lowPrice, closePrice, netChange, percentChange, markPrice and changes, timeValue, intrinsicValue, theoreticalVolatility, isInTheMoney, daysToExpiration, optionDeliverablesList, isPennyPilot, isMini, isNonStandard: chains holds no column for themGET /chainsOpenAPI OptionContract, 2026-12-04
The chain's own words: strategy (ANALYTICAL prices a chain off a volatility, underlyingPrice, interestRate and daysToExpiration the caller sends; VERTICAL, CALENDAR, STRADDLE and the other spreads), interval, range, expMonth, optionType, includeUnderlyingQuote (an underlying block), entitlement; Taji sends fromDate, toDate, contractType and strikeCountGET /chainsOpenAPI /chains and OptionChain, 2026-12-04
An option quote's delta, gamma, theta, vega, rho, volatility, openInterest, theoreticalOptionValue, underlyingPrice, timeValue, moneyIntrinsicValue, and streamed as fields 9 to 11, 28 to 32 and 34 to 35: quotes has no such column, and no live chain is built from themGET /quotes, LEVELONE_OPTIONSOpenAPI QuoteOption, 2026-12-04; Streamer, 2026-12-02
A quote's exchange ids (bidMICId, askMICId, lastMICId; level-one Bid ID, Ask ID, Last ID): the decoders drop them, so last_exchange stays null and no column holds the bid's or ask'sGET /quotes, LEVELONE_EQUITIES, LEVELONE_FUTURESOpenAPI QuoteEquity, QuoteFuture, 2026-12-04; Streamer, 2026-12-02
A quote's day figures and marks: openPrice, highPrice, lowPrice, closePrice, totalVolume, netChange, 52WeekHigh, 52WeekLow, mark; quotes holds none (the day bar of forming_day reads five of them)GET /quotes, every LEVELONE_*OpenAPI QuoteEquity, 2026-12-04; Streamer, 2026-12-02
An index's securityStatus: an index quote states no book, so its halted is lost with itGET /quotes, LEVELONE_EQUITIES on $SPXOpenAPI QuoteIndex, 2026-12-04; Streamer, 2026-12-02
The extended block (pre- and post-market bid, ask, last and sizes), the regular block and the fundamental block (peRatio, divYield, divAmount, divExDate, nextDivExDate, eps): fields defaults to all and the decoder reads quote and reference alone; quotes.session stays nullGET /quotesOpenAPI ExtendedMarket, RegularMarket, Fundamental, 2026-12-04
indicative=true: the $ABC.IV indicative quote of each ETF askedGET /quotesOpenAPI /quotes, 2026-12-04
An equity's reference words htbQuantity, htbRate, otcMarketTier, fsiDesc; an option's exerciseType, deliverables, optionRoot (chains.style is never filled): instrument reads isShortable and isHardToBorrow aloneGET /quotes (reference)OpenAPI ReferenceEquity, ReferenceOption, 2026-12-04
A future's reference (exchange, futureMultiplier, futureExpirationDate, futureSettlementPrice, futureTradingHours, product) and its quote's tick and tickAmount: instrument is read off the entry's top level, so a future's row states only class and kind (its trades_as and until come from the kernel off the expiry)GET /quotesOpenAPI ReferenceFuture, QuoteFuture, 2026-12-04
A future's openInterest, futureSettlementPrice, quotedInSession and futureIsActiveGET /quotes, LEVELONE_FUTURESOpenAPI QuoteFuture, 2026-12-04; Streamer, 2026-12-02
The fundamental projection's 58 fields, of which details reads 15: marketCap and sharesOutstanding (columns exist; unit unmeasured), marketCapFloat, avg1DayVolume, eps, epsChange*, revChange*, the margins, returnOnEquity, returnOnAssets, the debt and coverage ratios, shortIntToFloat, shortIntDayToCover, dividendFreq, nextDividendDate, fundStrategyGET /instruments?projection=fundamentalOpenAPI FundamentalInst, 2026-12-04
A mover's direction: screener has no column for itGET /movers/{index}OpenAPI Screener, 2026-12-04
The SCREENER_EQUITY and SCREENER_OPTION streams (marketShare, netChange, trades, the frequency's volume, sort AVERAGE_PERCENT_VOLUME): SchwabStream::screener is built and tested, but no hub product reads itSCREENER_EQUITY, SCREENER_OPTIONStreamer, 2026-12-02
A book level's market-maker entries (ID, size, quote time): depth has no column for the makerNYSE_BOOK, NASDAQ_BOOK, OPTIONS_BOOKStreamer, 2026-12-02
A candle's previousClose and its date (needPreviousClose): bars holds no previous closeGET /pricehistoryOpenAPI /pricehistory, 2026-12-04
Market hours by market and product: isOpen and each session's intervalGET /markets, GET /markets/{market}OpenAPI Hours, 2026-12-04
Forex: quotes and the LEVELONE_FOREX stream; no streamer service subscribes to it, so offer.rs offers no forexGET /quotes, LEVELONE_FOREXOpenAPI ForexResponse, 2026-12-04; Streamer, 2026-12-02

Trades are not offered: Schwab has no time-and-sales stream, and level one carries the last print only (owner, 2026-12-03).

Code map​

Each file is under plugins/schwab/. Each line says what the file owns, then the entry point to read first.

  • taji-plugin.toml: identity, the schwab link form, its fields and steps. Read [[link]].

  • src/lib.rs: Plugin::build registers the source, the venue arm and the link auth; it also holds API_BASE, HOSTS, and SchwabError with its mapping to BrokerageError. Read impl From<SchwabError> for BrokerageError.

  • src/auth.rs: TokenStore, the access token held as the login's marker, refreshed 5 minutes before it dies and once after a 401. It also holds each login's shared state (mint turn, budgets, streamer slot) and the relink and rotation flags. Read TokenStore::mint.

  • src/http.rs: SchwabClient, the one chokepoint for every REST send. It applies budget admission, the bearer, one resend after a 401, and the 429 hold; warm keeps the connection open. Read SchwabClient::send.

  • src/ratelimit.rs: one sign-in's budgets: schwab-market, schwab-account, and schwab-orders <hash> per account. Read RateLimits::budget.

  • src/link.rs: Auth, the link check (accountNumbers on the candidate token) and the OAuth sign-in declared to the kernel. Read Auth::check.

  • src/accounts.rs:

    • account_numbers, SchwabAccount (reads and writes by hash, re-reading a hash that moved), and SchwabReads (VenueReads);
    • SchwabBroker (ExecutionOps), with the lost-ack read-back;
    • schwab_capabilities.

    Read SchwabBroker::place.

  • src/orders.rs: order_body, Taji's OrderIntent as Schwab's order JSON. MAPPED, DEFERRED, FIELDS and FIELDS_DEFERRED account for every member of schwab-py's enums. Read order_body.

  • src/orders/tests.rs: every order shape, including the_portals_examples_are_the_bodies_sent.

  • src/history.rs: SchwabBars (HistoricalData) and candles_raw. A long ask is cut into windows, and a dated future that is not the front is refused. Read candles_raw.

  • src/market.rs: the market-data REST reads, each answering the vendor's JSON as sent, plus the Raw formats the store keeps. Read quotes_with and chains_raw.

  • src/source.rs: Schwab (Source) with FACTS, CAP (the bars row), READS, HOTLISTS and probe_tier. It also holds the quote, chain-leg, forming-day, details, raw-read and tick paths. Read impl Source for Schwab.

  • src/stream.rs: SchwabStream, the login's one streamer socket (LiveStream). It owns login, subscriptions, reconnect, the field names, the level-one merge and the minute forming off level-one trades. Read run, then session_loop.

  • src/stream/tests.rs: a fake streamer covering login, frames, reconnects and forming.

  • src/symbol.rs: the one map between Taji's spellings and Schwab's (OCC padding, /ESZ26, ./…, $SPX). Read spell.

  • src/venue.rs: the venue's FACTS (VenueFacts), Arm (VenueArm), and arm, which binds one account row. Read arm.

  • src/offer.rs: OFFER and VENUE_OFFER, the coverage cells with their sources and audit dates. Read data and orders.

  • src/fake.rs: under test-support, a loopback client and a chain vendor for taji-trading's tests.

  • tests/egress.rs with tests/egress/*.txt: goldens of every byte sent (token mint, REST, 401 retry, order write, streamer login), and proof that no redirect is followed.

  • plugins/schwab/scripts/schwab_walk.py: the walk against a running kernel and the user's linked app.

How it plugs into Taji​

SDK traits. Plugin::build in plugins/schwab/src/lib.rs registers three things, and engine/crates/taji-open/src/lib.rs composes the plugin into the binary.

TraitTypeFile
Sourcesource::Schwabplugins/schwab/src/source.rs
HistoricalDataSchwabBarsplugins/schwab/src/history.rs
LiveStreamSchwabStreamplugins/schwab/src/stream.rs
VenueArmvenue::Armplugins/schwab/src/venue.rs
ExecutionOpsSchwabBrokerplugins/schwab/src/accounts.rs
VenueReadsSchwabReadsplugins/schwab/src/accounts.rs
Auth (link)link::Authplugins/schwab/src/link.rs

ReconcileOps comes from ExecutionOps (docs/plugins/provider.md). The crate implements no FuturesOps, no VenueReads::groups and no ExecutionOps::regroup, so the kernel keeps the account's position groups.

Statics. Read each one in its file; this page does not retype them.

  • source::FACTS declares:
    • Seat::Venue, so the source is seated only on the login a linked row seals;
    • every (class, product, span) triple in READS;
    • gated on every class, because each quote entry carries its own real-time flag;
    • the bars row CAP (classes, depths, native 5m and 30m, adjustments split-spinoff);
    • the books NYSE_BOOK and NASDAQ_BOOK (XNYS, XNAS) and OPTIONS_BOOK.
  • venue::FACTS declares one record, (Env::Live, "schwab"); ProtectionMatrix::default(), so no venue-held stop is claimed; unwalked: true; and LinkFacts with lapses_s of 7 days, callback and tier_by_class.
  • offer::OFFER and VENUE_OFFER feed the coverage page.

Link forms. The manifest's one form, schwab (env = "live", kind = "oauth"), takes a client ID, a client secret and a callback URL. Its steps are in the manifest.

  • link::Auth::sign_in declares the authorize and token URLs, ClientAuth::Basic, no PKCE, and the callback https://127.0.0.1:8182.
  • The kernel runs the ceremony on a TLS loopback (engine/crates/taji/src/entitlements/oauth.rs) and exchanges the code.
  • Auth::check then reads accountNumbers on the new token in a store of its own (TokenStore::unlisted), so a refused link never touches the seated sign-in. Each listed number becomes a live row that keeps only its tail and hash.

Surfaces and the vendor call behind each.

Taji surfaceVendor callMade in
POST /verb/link/venue/oauth/v1/oauth/authorize, the code exchange, then GET /trader/v1/accounts/accountNumbersplugins/schwab/src/link.rs
GET /get/bars (equity, index, future, option)GET /marketdata/v1/pricehistory, one window per 48 days at 1m or 260 days at 5 to 30mplugins/schwab/src/history.rs
Live 1m bars on /ws/market (equity, future)streamer CHART_EQUITY and CHART_FUTURES, with the forming minute off LEVELONE_* tradesplugins/schwab/src/stream.rs
GET /get/quotes, the chain's leg quotes, the forming dayGET /marketdata/v1/quotesplugins/schwab/src/source.rs
Live quotes and depth on /ws/marketLEVELONE_EQUITIES, LEVELONE_OPTIONS, LEVELONE_FUTURES, LEVELONE_FUTURES_OPTIONS, NYSE_BOOK, NASDAQ_BOOK, OPTIONS_BOOKplugins/schwab/src/source.rs open_ticks
GET /get/chains (option)/chains, or /expirationchain for the expirationsplugins/schwab/src/source.rs chains_raw
GET /get/screener (equity hotlists)/movers/{index} with sort and frequencyplugins/schwab/src/source.rs screener_raw
GET /get/search, GET /get/instrument, GET /get/details (equity)/instruments by projection, /instruments/{cusip}plugins/schwab/src/source.rs
GET /get/search and GET /get/instrument (future)/quotes on each listed month over two years, and its referenceplugins/schwab/src/source.rs contracts_raw, future_raw
GET /read/trading/book, balances and positionsGET /trader/v1/accounts/{hash}?fields=positionsplugins/schwab/src/accounts.rs
GET /read/trading/<acct>/orders, reconcileGET /trader/v1/accounts/{hash}/ordersplugins/schwab/src/accounts.rs
POST /verb/trading/orders/<class>/placePOST /trader/v1/accounts/{hash}/ordersplugins/schwab/src/accounts.rs, plugins/schwab/src/orders.rs
POST /verb/trading/orders/<class>/previewPOST /trader/v1/accounts/{hash}/previewOrderplugins/schwab/src/accounts.rs
POST /verb/trading/<acct>/orders/<order>/repriceGET the order, then PUT /trader/v1/accounts/{hash}/orders/{id}plugins/schwab/src/accounts.rs
POST /verb/trading/<acct>/orders/<order>/cancelDELETE /trader/v1/accounts/{hash}/orders/{id}plugins/schwab/src/accounts.rs
The reconcile's wakestreamer ACCT_ACTIVITY on the session's correlation idplugins/schwab/src/venue.rs wakes
link.venues.schwab relink, rotated, rate scopesnone: auth::relink, auth::rotated, auth::rate_limitsplugins/schwab/src/auth.rs

One read, wire to vendor and back: GET /get/bars?symbols=equity:AAPL… at 1m

  1. The kernel's route asks the hub (engine/crates/taji-trading/src/hub.rs) for a bars client for provider schwab.
  2. The hub calls Source::history, which builds a SchwabBars over a SchwabClient on the hub's login, then get_bars_session_raw.
  3. SchwabBars::ask spells the item (symbol::spell). The extended session sets needExtendedHoursData; any other session is refused. its_own_candles checks that a dated future is its root's front.
  4. candles_raw cuts the span into windows and asks the latest first. Each GET /marketdata/v1/pricehistory goes through SchwabClient::send:
    • the schwab-market budget admits it;
    • TokenStore::token refreshes the access token if it is within 5 minutes of dying;
    • the login sends it with the bearer swapped in;
    • a 401 refreshes once and resends;
    • a 429 holds the market budget 4 s and answers RateLimited. Once a window has landed, the read answers RateLimitedPart with the bars it holds.
  5. Each window's bytes are kept as a Raw page (schwab.bars.v1). The hub's store keeps them, and parse_bars turns them into OHLCV: stamped at the open, with daily and longer candles moved to UTC midnight of the New York session date.

One order, wire to vendor and back: POST /verb/trading/orders/equity/place

  1. The kernel validates the OrderKind and hands an OrderIntent to the account's root (engine/crates/taji-trading/src/root.rs).
  2. The root calls the bound arm's place_order through Queued, the login's one write slot (engine/crates/taji-trading/src/arms.rs).
  3. SchwabBroker::place builds the body with orders::order_body; an unsupported class or word is refused here, unsent. It then lists the account's orders entered in the last 60 s.
  4. SchwabAccount::place sends POST /trader/v1/accounts/{hash}/orders as one logical send (resent once only after a 401), on the schwab-orders <hash> budget, 120 a minute.
  5. A 201's Location ends in the order id, which is answered accepted.
  6. An answer that does not prove the order absent is never re-posted. That covers a transport failure, a 429, a 5xx, or a 2xx with no id. Instead readback waits 1 s, lists again, and adopts the one new order with the same leg, order type and prices. None found, or several, is AckedUnconfirmed.
  7. Fills and later states reach the book through the reconcile, which ACCT_ACTIVITY wakes and orders_since and order_status answer.

Why it is built this way​

  • The user's own app, never a shared one. Each person registers a Trader API – Individual app that reaches only their accounts. Taji ships no client id or secret, and the key and secret are sealed in the vault (ADR 0005; plugin page, Access).
  • Credentials are markers, not values. The crate holds the client id, secret and tokens only as the login's markers (Login::secret). The host swaps them in toward a granted host. Login::seal moves a token answer's access_token, refresh_token and id_token into the login before the crate reads it. tests/egress.rs proves that a streamer on an ungranted host never hears LOGIN, and that no redirect carries the bearer or the Basic credential onward (ADR 0005).
  • One token state, one budget set, one streamer per login. Two holders refreshing one sign-in lock one out (schwab-py), and a second streamer login ends the first (code 12). So auth::shared keys one Shared per login, which the hub's source and every account arm share: one mint turn, one RateLimits, one stream Slot.
  • Live only, and nothing walked. Schwab has no paper (portal, Accounts and Trading). VenueFacts.records is live alone, the manifest's risk says the order path has not been run against Schwab, and unwalked: true keeps the order cells declared, not measured. Live orders wait for approval (ADR 0008).
  • A lost ack is read back, never re-posted. Schwab's order request takes no client id: tag is server-set, and a duplicate POST places twice (plugin page, Orders). So expected_ref is None, and place lists the orders before the POST and matches after it.
  • A group or a spread is listed with its reason to stay put. Schwab replaces by cancelling and creating, and nothing documents that a child of a TRIGGER or OCO keeps its link or which id a replacement gets. The listing fills each member's price (stop, else limit), its limit when it is a stop-limit, and an exit's tranche (an OCO pair is one), and sets Asked.fixed on a group and on any order whose member the venue marks editable: false. A replace with a leg, or of an order with a member marked so, answers NotInPlace with the same words. A multi-leg order lists no Asked, so the kernel refuses it (plugin page, Orders).
  • No venue-held protection is claimed. protection() is the default, and exit plans are supervised (plugin page, Open).
  • Bars are as given.
    • Schwab states no adjustment basis. The table assumes split-spinoff, as TradeStation's does, and refuses any other basis (ADR 0007).
    • startDate and endDate are sent with no period, because the two do not combine reliably (schwaby, plugins/schwab/src/history.rs header).
    • A later month of a future is refused, because pricehistory answers the front whatever month is asked (measured 2026-11-04, plugin page, Data).
  • Tier off one probe. mktDataPermission reads NP in every sample and names a subscriber class, not a tier. So on bind, probe_tier asks /quotes for AAPL, $SPX and /ES and seats each class's grant from its realtime flag. A delayed class is late 15 minutes, or 10 for CME futures.
  • A live minute forms between chart rows. A CHART_EQUITY row lands about 3 s past its minute (measured). So Forming builds the open minute from the symbol's level-one trades, and the chart row alone closes it (closes_every_bar). Schwab streams no time and sales.
  • Every route serves a platform product. Movers serve the screener hotlists, and a future root's months serve search. No Schwab-shaped read reaches a client (ADR 0004).
  • No redirect is followed. Both the token client and the REST client are order_clients, which follow no redirect. A redirect on the token endpoint would carry the Basic credential and the form onward; on an order POST it would place twice.

Constraints and limits​

The numbers live on the plugin page's Transport and limits and Data; this section is the mechanism.

  • REST budgets (plugins/schwab/src/ratelimit.rs):
    • A path under /marketdata/ draws schwab-market.
    • A write under /trader/v1/accounts/<hash>/ draws that account's schwab-orders <hash>, a 120-a-minute window that refuses unsent once full.
    • Everything else draws schwab-account.
    • market and account count but refuse nothing, because Schwab publishes no read limit. A 429 holds the budget it hit for HOLD, 4 s, since Schwab sends no Retry-After. Later sends on that budget are refused unsent with RateLimited until the hold ends.
    • A 429 on a read answers RateLimited. On an order POST it answers its status, because a 429 there does not prove the order absent, and place reads back.
    • Nothing is resent on a 429.
    • The hub sends at most REACH_SHARE, 16, bar requests at once for one reach.
  • Token life. TokenStore::token refreshes inside REFRESH_MARGIN_SECS, 5 minutes. A burst of callers waits on one mint turn and sends one POST. refresh_if_still refreshes after a 401 only if no other store already replaced the rejected token.
    • A refusal naming invalid_grant, invalid_client or refresh_token_authentication_error, at the outer level or nested in error_description, sets relink. From then on nothing is sent, and Source::expired reports the sign-in due.
    • A refresh that answers a new refresh token sets rotated. The host's vault keeps the new one, and the 7 days do not move.
  • Streamer. One SchwabStream per login owns the process's only socket. The first subscription opens it, and it closes once no consumer is left. Each connect does four things: it reads userPreference, dials, presents the token in LOGIN, and resubscribes every held key.
    • A socket that is lost, or silent for 30 s, is redialled with backoff from 1 s to 60 s, and never given up while a consumer holds it.
    • LOGIN_DENIED refreshes the token and redials.
    • A notify with a non-zero code, such as 12 (another login took the session), drops the session and redials. Two Taji processes on one sign-in therefore take the session from each other.
    • A dead sign-in lapses every consumer at once.
    • LEVELONE_* frames carry only changed fields, so each is merged into the subscription's whole quote.
  • Entitlements. Each /quotes entry and tick carries its own delayed. Each class's grant comes from probe_tier at bind; a failed probe seats nothing.
  • Symbology (plugins/schwab/src/symbol.rs):
    • An option is OCC, padded to a six-character root.
    • A dated future is / + root + month code + two-digit year, and a continuous @ES or ES1! is the bare root /ES, Schwab's front.
    • A future option is ./ + the future + C|P + strike.
    • An index is $SPX.
    • Crypto, forex, spreads, parents and series have no spelling and are refused as NoSource.
    • A root's quote comes back keyed by its front (/NQ as /NQZ26), and symbol::front reads it back.
  • Refusals before HTTP. order_body refuses every class but equity and option, and every word in DEFERRED. SchwabBars::ask refuses a timeframe Schwab has no candles of and a session other than regular or extended. basis refuses an adjustment other than split-spinoff.
  • Account hash. A 400 or 404 on an account path re-reads accountNumbers. If that account's hash moved, the call is retried once on the new hash.
  • Orders window. The orders read reaches back 364 days at most, because Schwab refuses a window over a year with 400 Invalid date range.

Examples​

Ids and tokens are masked: <ACCT> for an account number, pN for any other id.

A refresh grant. Taji sends this when the access token is within 5 minutes of dying. The capture is the golden plugins/schwab/tests/egress/mint.txt, made by tests/egress.rs mint:

http POST /v1/oauth/token
accept: application/json
accept-encoding: gzip
authorization: Basic p1
content-length: 46
content-type: application/x-www-form-urlencoded
body grant_type=refresh_token&refresh_token=p2

The answer the code is written against, from the unit test auth.rs tokens:

{"expires_in": 1800, "token_type": "Bearer", "scope": "api",
"refresh_token": "p2", "access_token": "p5", "id_token": "p4"}

A read answered 401. One mint, then one resend on the new token. The capture is plugins/schwab/tests/egress/auth_retry.txt, with headers trimmed:

http GET /marketdata/v1/quotes?symbols=AAPL
authorization: Bearer p3

http POST /v1/oauth/token
authorization: Basic p1
body grant_type=refresh_token&refresh_token=p2

http GET /marketdata/v1/quotes?symbols=AAPL
authorization: Bearer p5

The streamer's login and first subscription. A live quote on AAPL causes this. The capture is plugins/schwab/tests/egress/stream.txt; the field list is trimmed:

http GET /trader/v1/userPreference
authorization: Bearer p3

handshake /
frame {"requests":[{"SchwabClientCorrelId":"p6","SchwabClientCustomerId":"p7","command":"LOGIN","parameters":{"Authorization":"p3","SchwabClientChannel":"N9","SchwabClientFunctionId":"APIAPP"},"requestid":"0","service":"ADMIN"}]}

frame {"requests":[{"SchwabClientCorrelId":"p6","SchwabClientCustomerId":"p7","command":"SUBS","parameters":{"fields":"0,1,2,…,51","keys":"AAPL"},"requestid":"1","service":"LEVELONE_EQUITIES"}]}

Bars. GET /get/bars on index:$SPX.X at 1m, or on option:AAPL261218C00250000 at daily, causes these. Schwab's answers are shaped as Schwab's in plugins/schwab/src/history.rs each_class_asks_in_schwabs_spelling_and_reads_its_answer, their figures made up, which mounts them on pricehistory with symbol=$SPX&frequencyType=minute and symbol=AAPL 261218C00250000&frequencyType=daily:

{"symbol": "$SPX", "empty": false, "candles": [
{"open": 6000.5, "high": 6010.5, "low": 6000.5, "close": 6005.5, "volume": 0, "datetime": 1793021400000},
{"open": 6005.0, "high": 6005.0, "low": 5995.5, "close": 5995.5, "volume": 0, "datetime": 1793021460000}]}
{"symbol": "AAPL 261218C00250000", "empty": false, "candles": [
{"open": 90.5, "high": 95.5, "low": 88.5, "close": 88.5, "volume": 10, "datetime": 1790571600000}, …]}

Taji's bars, as the test asserts them, as (time, …):

  • $SPX: (1793021400, close 6005.5, volume 0) and (1793021460, 5995.5, 0). An index candle has no volume.
  • The option: (1790553600, high 95.5). The candle Schwab stamped 05:00 UTC lands on UTC midnight of its session date, 2026-09-28.

An order body. An equity market buy of 15 and a single-option limit both produce the portal's own order samples. The body is the one POST /trader/v1/accounts/<ACCT>/orders carries; the source is plugins/schwab/src/orders/tests.rs the_portals_examples_are_the_bodies_sent:

{"complexOrderStrategyType": "NONE", "orderType": "LIMIT", "session": "NORMAL",
"price": "6.45", "duration": "DAY", "orderStrategyType": "SINGLE",
"orderLegCollection": [{"instruction": "BUY_TO_OPEN", "quantity": 10,
"instrument": {"symbol": "XYZ 240315C00050000", "assetType": "OPTION"}}]}

An order POST answered 401. It is refreshed and resent exactly once, to the loopback alone. The capture is plugins/schwab/tests/egress/write.txt, with headers trimmed:

http POST /trader/v1/accounts/p8/orders
authorization: Bearer p3
body {"duration":"DAY","orderType":"LIMIT","price":"1.00","session":"NORMAL"}

http POST /v1/oauth/token
body grant_type=refresh_token&refresh_token=p2

http POST /trader/v1/accounts/p8/orders
authorization: Bearer p5
body {"duration":"DAY","orderType":"LIMIT","price":"1.00","session":"NORMAL"}

The kernel's answer for a Schwab account. This is a row of GET /read/trading/book in the wire fixture engine/crates/taji/tests/fixtures/wire/trading-book.json, trimmed:

{"alias": "Schwab live ····<ACCT>", "arm": "live", "brokerage": "schwab",
"buying_power": "100000", "cash": "50000", "classes": ["equity", "option"],
"equity": "100000", "id": "schwab_live_<ACCT>", "kind": "margin", "live": true,
"state": "bound", "tail": "<ACCT>", …}

Live captures. There is no capture yet of a live vendor answer for accounts, orders, quotes, chains or stream frames. The walk's accounts, data, live and order phases would make them, as would engine/crates/taji-open/tests/schwab_live.rs; see Testing.

Testing​

Offline. No key is needed and nothing dials Schwab:

  • cargo test -p taji-schwab runs the unit tests: wiremock for REST and the token endpoint, a fake streamer in src/stream/tests.rs, and every order shape in src/orders/tests.rs. It also runs tests/egress.rs, whose goldens under tests/egress/ hold every byte sent.
  • The code-exchange golden, tests/egress/exchange.txt, is written by the kernel's OAuth test in engine/crates/taji/src/entitlements/oauth.rs.
  • cargo test -p taji-trading covers binding: two Schwab rows on one sign-in sharing its write slot and budgets, in engine/crates/taji-trading/src/arms.rs.

Live suite. This needs your app's key and a browser sign-in. It is engine/crates/taji-open/tests/schwab_live.rs; the crate has no tests/live.rs, because the sign-in is the kernel's OAuth code, which a plugin crate may not depend on. From the repo root:

TAJI_LIVE_SIGNIN=1 cargo test -p taji-open --test schwab_live -- --ignored --test-threads=1 [filter]
  • SCHWAB_API_KEY and SCHWAB_API_SECRET come from the keys file or the process. You sign in at the URL it prints, and the tokens are held in memory only. Without all three, every test is a SKIP before any call.
  • Reads run any hour. Live-stream reads run in regular trading hours, or Globex hours for futures.
  • Order tests are a SKIP unless SCHWAB_LIVE_ORDERS=1, and fills need LIVE_FILLS=1 too. Every Schwab account is live: set these only after your person's yes. They rest on AAPL and its call nearest the money three weeks out, each guarded and cancelled.
  • A login with several accounts takes SCHWAB_ACCOUNT.
  • engine/crates/taji-open/scripts/vendor_live.sh runs the read tests with SCHWAB_LIVE_ORDERS=0.

Walk. This runs against a headless kernel you started per AGENTS.md, after you link with taji-link schwab in a TTY:

plugins/schwab/scripts/schwab_walk.py <port> link|accounts|bars|data|live|relink|order|cleanup
  • Every phase but order only reads. order refuses unless WALK_ORDER_YES=1, set only after your person's yes, because it places live orders.
  • live runs in regular trading hours, or Globex hours for futures, and is a SKIP otherwise.
  • Each phase writes its dated answers to <state dir>/schwab-walk.json.
  • link and accounts were walked on 2026-10-08; every other phase is not yet walked.

References​

Each was fetched 2026-12-02.