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-rscopies it (itsmarket_data.openapi.json, a community copy of the portal's, fetched 2026-12-04): the fields of each REST answer, named below asOpenAPI. - 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.
- One production environment. REST lives under
https://api.schwabapi.com/trader/v1(accounts and trading) and/marketdata/v1(market data), and OAuth lives at/v1/oauth/authorizeand/v1/oauth/token(portal, Accounts and Trading; portal, Accounts and Trading spec; portal, Market Data spec). - There is no paper account and no sandbox. The portal says "The Trader API Sandbox environments will be available later this year" (portal, Accounts and Trading), so every order is real money.
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, asPOST /v1/oauth/tokenwithAuthorization: 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.1is allowed (portal, Accounts and Trading), with a port (schwab-py auth, which recommendshttps://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"andtoken_type: "Bearer".
API families Taji calls.
- Accounts and Trading (portal, Accounts and Trading spec):
GET /accounts/accountNumbers, which maps each account number to thehashValueevery account path takes;GET /accounts/{hash}?fields=positions;GET /accounts/{hash}/orders, which needsfromEnteredTimeandtoEnteredTime, spans at most one year, and defaultsmaxResultsto 3000;GET,PUTandDELETE/accounts/{hash}/orders/{id};POST /accounts/{hash}/ordersandPOST /accounts/{hash}/previewOrder;GET /userPreference.
- Market Data (portal, Market Data spec):
/quotes,/chains,/expirationchain,/pricehistory,/movers/{index},/instrumentsand/instruments/{cusip},/marketsand/markets/{market}.pricehistorytakesperiodType,frequencyType,frequency(minute 1, 5, 10, 15 or 30) andstartDate/endDatein epoch milliseconds.
- Streamer (portal, Streamer; schwab-py streaming): one WebSocket.
ADMIN/LOGINpresents the access token; thenSUBS,ADDandUNSUBSare 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_EQUITYfields: the portal's table puts Open–Volume at 1–5 and Sequence at 6, while schwab-py'sChartEquityFields(read 2026-12-02) putsSEQUENCEat 1 and OHLCV at 2–6.stream.rsfollows schwab-py, and the measured chart rows agree.
- Response code 3 is
- 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
/quotesentry saysrealtimetrue 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_bodyrefuses every other class before any HTTP. - Option exercise. No source shows its body, so
ExecutionOps::exerciserefuses (plugins/schwab/src/orders.rsDEFERRED). - The order enum members no source gives a body or a meaning for (strategies
CANCEL,RECALL,PAIRand others; order typesCABINET,NON_MARKETABLE): they are listed inDEFERREDandFIELDS_DEFERREDwith each one's reason. - The sandbox. It does not exist.
/accounts/{hash}/transactionsandGET /ordersacross all accounts. Not yet built./{symbol}/quotes. It breaks on futures symbols such as/ES(schwab-py), so every quote goes through/quotes.market::quotekeeps 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).
| Offered | Endpoint | Source, fetched |
|---|---|---|
A chain contract's theoreticalOptionValue (a theo column exists) and lastTradingDay (last_trade_at): chain_rows drops both | GET /chains | OpenAPI 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 them | GET /chains | OpenAPI 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 strikeCount | GET /chains | OpenAPI /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 them | GET /quotes, LEVELONE_OPTIONS | OpenAPI 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's | GET /quotes, LEVELONE_EQUITIES, LEVELONE_FUTURES | OpenAPI 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 it | GET /quotes, LEVELONE_EQUITIES on $SPX | OpenAPI 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 null | GET /quotes | OpenAPI ExtendedMarket, RegularMarket, Fundamental, 2026-12-04 |
indicative=true: the $ABC.IV indicative quote of each ETF asked | GET /quotes | OpenAPI /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 alone | GET /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 /quotes | OpenAPI ReferenceFuture, QuoteFuture, 2026-12-04 |
A future's openInterest, futureSettlementPrice, quotedInSession and futureIsActive | GET /quotes, LEVELONE_FUTURES | OpenAPI 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, fundStrategy | GET /instruments?projection=fundamental | OpenAPI FundamentalInst, 2026-12-04 |
A mover's direction: screener has no column for it | GET /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 it | SCREENER_EQUITY, SCREENER_OPTION | Streamer, 2026-12-02 |
A book level's market-maker entries (ID, size, quote time): depth has no column for the maker | NYSE_BOOK, NASDAQ_BOOK, OPTIONS_BOOK | Streamer, 2026-12-02 |
A candle's previousClose and its date (needPreviousClose): bars holds no previous close | GET /pricehistory | OpenAPI /pricehistory, 2026-12-04 |
Market hours by market and product: isOpen and each session's interval | GET /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 forex | GET /quotes, LEVELONE_FOREX | OpenAPI 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, theschwablink form, its fields and steps. Read[[link]]. -
src/lib.rs:Plugin::buildregisters the source, the venue arm and the link auth; it also holdsAPI_BASE,HOSTS, andSchwabErrorwith its mapping toBrokerageError. Readimpl 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. ReadTokenStore::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;warmkeeps the connection open. ReadSchwabClient::send. -
src/ratelimit.rs: one sign-in's budgets:schwab-market,schwab-account, andschwab-orders <hash>per account. ReadRateLimits::budget. -
src/link.rs:Auth, the link check (accountNumberson the candidate token) and the OAuth sign-in declared to the kernel. ReadAuth::check. -
src/accounts.rs:account_numbers,SchwabAccount(reads and writes by hash, re-reading a hash that moved), andSchwabReads(VenueReads);SchwabBroker(ExecutionOps), with the lost-ack read-back;schwab_capabilities.
Read
SchwabBroker::place. -
src/orders.rs:order_body, Taji'sOrderIntentas Schwab's order JSON.MAPPED,DEFERRED,FIELDSandFIELDS_DEFERREDaccount for every member of schwab-py's enums. Readorder_body. -
src/orders/tests.rs: every order shape, includingthe_portals_examples_are_the_bodies_sent. -
src/history.rs:SchwabBars(HistoricalData) andcandles_raw. A long ask is cut into windows, and a dated future that is not the front is refused. Readcandles_raw. -
src/market.rs: the market-data REST reads, each answering the vendor's JSON as sent, plus theRawformats the store keeps. Readquotes_withandchains_raw. -
src/source.rs:Schwab(Source) withFACTS,CAP(the bars row),READS,HOTLISTSandprobe_tier. It also holds the quote, chain-leg, forming-day, details, raw-read and tick paths. Readimpl 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. Readrun, thensession_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). Readspell. -
src/venue.rs: the venue'sFACTS(VenueFacts),Arm(VenueArm), andarm, which binds one account row. Readarm. -
src/offer.rs:OFFERandVENUE_OFFER, the coverage cells with their sources and audit dates. Readdataandorders. -
src/fake.rs: undertest-support, a loopback client and a chain vendor fortaji-trading's tests. -
tests/egress.rswithtests/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.
| Trait | Type | File |
|---|---|---|
Source | source::Schwab | plugins/schwab/src/source.rs |
HistoricalData | SchwabBars | plugins/schwab/src/history.rs |
LiveStream | SchwabStream | plugins/schwab/src/stream.rs |
VenueArm | venue::Arm | plugins/schwab/src/venue.rs |
ExecutionOps | SchwabBroker | plugins/schwab/src/accounts.rs |
VenueReads | SchwabReads | plugins/schwab/src/accounts.rs |
Auth (link) | link::Auth | plugins/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::FACTSdeclares:Seat::Venue, so the source is seated only on the login a linked row seals;- every
(class, product, span)triple inREADS; gatedon every class, because each quote entry carries its own real-time flag;- the bars row
CAP(classes, depths,native5m and 30m,adjustmentssplit-spinoff); - the books
NYSE_BOOKandNASDAQ_BOOK(XNYS,XNAS) andOPTIONS_BOOK.
venue::FACTSdeclares one record,(Env::Live, "schwab");ProtectionMatrix::default(), so no venue-held stop is claimed;unwalked: true; andLinkFactswithlapses_sof 7 days,callbackandtier_by_class.offer::OFFERandVENUE_OFFERfeed 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_indeclares the authorize and token URLs,ClientAuth::Basic, no PKCE, and the callbackhttps://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::checkthen readsaccountNumberson 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 surface | Vendor call | Made in |
|---|---|---|
POST /verb/link/venue/oauth | /v1/oauth/authorize, the code exchange, then GET /trader/v1/accounts/accountNumbers | plugins/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 30m | plugins/schwab/src/history.rs |
Live 1m bars on /ws/market (equity, future) | streamer CHART_EQUITY and CHART_FUTURES, with the forming minute off LEVELONE_* trades | plugins/schwab/src/stream.rs |
GET /get/quotes, the chain's leg quotes, the forming day | GET /marketdata/v1/quotes | plugins/schwab/src/source.rs |
Live quotes and depth on /ws/market | LEVELONE_EQUITIES, LEVELONE_OPTIONS, LEVELONE_FUTURES, LEVELONE_FUTURES_OPTIONS, NYSE_BOOK, NASDAQ_BOOK, OPTIONS_BOOK | plugins/schwab/src/source.rs open_ticks |
GET /get/chains (option) | /chains, or /expirationchain for the expirations | plugins/schwab/src/source.rs chains_raw |
GET /get/screener (equity hotlists) | /movers/{index} with sort and frequency | plugins/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 reference | plugins/schwab/src/source.rs contracts_raw, future_raw |
GET /read/trading/book, balances and positions | GET /trader/v1/accounts/{hash}?fields=positions | plugins/schwab/src/accounts.rs |
GET /read/trading/<acct>/orders, reconcile | GET /trader/v1/accounts/{hash}/orders | plugins/schwab/src/accounts.rs |
POST /verb/trading/orders/<class>/place | POST /trader/v1/accounts/{hash}/orders | plugins/schwab/src/accounts.rs, plugins/schwab/src/orders.rs |
POST /verb/trading/orders/<class>/preview | POST /trader/v1/accounts/{hash}/previewOrder | plugins/schwab/src/accounts.rs |
POST /verb/trading/<acct>/orders/<order>/reprice | GET the order, then PUT /trader/v1/accounts/{hash}/orders/{id} | plugins/schwab/src/accounts.rs |
POST /verb/trading/<acct>/orders/<order>/cancel | DELETE /trader/v1/accounts/{hash}/orders/{id} | plugins/schwab/src/accounts.rs |
| The reconcile's wake | streamer ACCT_ACTIVITY on the session's correlation id | plugins/schwab/src/venue.rs wakes |
link.venues.schwab relink, rotated, rate scopes | none: auth::relink, auth::rotated, auth::rate_limits | plugins/schwab/src/auth.rs |
One read, wire to vendor and back: GET /get/bars?symbols=equity:AAPL… at 1m
- The kernel's route asks the hub (
engine/crates/taji-trading/src/hub.rs) for a bars client for providerschwab. - The hub calls
Source::history, which builds aSchwabBarsover aSchwabClienton the hub's login, thenget_bars_session_raw. SchwabBars::askspells the item (symbol::spell). The extended session setsneedExtendedHoursData; any other session is refused.its_own_candleschecks that a dated future is its root's front.candles_rawcuts the span into windows and asks the latest first. EachGET /marketdata/v1/pricehistorygoes throughSchwabClient::send:- the
schwab-marketbudget admits it; TokenStore::tokenrefreshes 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 answersRateLimitedPartwith the bars it holds.
- the
- Each window's bytes are kept as a
Rawpage (schwab.bars.v1). The hub's store keeps them, andparse_barsturns them intoOHLCV: 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
- The kernel validates the
OrderKindand hands anOrderIntentto the account's root (engine/crates/taji-trading/src/root.rs). - The root calls the bound arm's
place_orderthroughQueued, the login's one write slot (engine/crates/taji-trading/src/arms.rs). SchwabBroker::placebuilds the body withorders::order_body; an unsupported class or word is refused here, unsent. It then lists the account's orders entered in the last 60 s.SchwabAccount::placesendsPOST /trader/v1/accounts/{hash}/ordersas one logical send (resent once only after a 401), on theschwab-orders <hash>budget, 120 a minute.- A 201's
Locationends in the order id, which is answeredaccepted. - 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
readbackwaits 1 s, lists again, and adopts the one new order with the same leg, order type and prices. None found, or several, isAckedUnconfirmed. - Fills and later states reach the book through the reconcile, which
ACCT_ACTIVITYwakes andorders_sinceandorder_statusanswer.
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::sealmoves a token answer'saccess_token,refresh_tokenandid_tokeninto the login before the crate reads it.tests/egress.rsproves that a streamer on an ungranted host never hearsLOGIN, 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::sharedkeys oneSharedper login, which the hub's source and every account arm share: one mint turn, oneRateLimits, one streamSlot. - Live only, and nothing walked. Schwab has no paper (portal, Accounts and Trading).
VenueFacts.recordsis live alone, the manifest'srisksays the order path has not been run against Schwab, andunwalked: truekeeps 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:
tagis server-set, and a duplicate POST places twice (plugin page, Orders). Soexpected_refisNone, andplacelists 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
TRIGGERorOCOkeeps its link or which id a replacement gets. The listing fills each member'sprice(stop, else limit), itslimitwhen it is a stop-limit, and an exit'stranche(an OCO pair is one), and setsAsked.fixedon a group and on any order whose member the venue markseditable: false. A replace with aleg, or of an order with a member marked so, answersNotInPlacewith the same words. A multi-leg order lists noAsked, 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).
startDateandendDateare sent with noperiod, because the two do not combine reliably (schwaby,plugins/schwab/src/history.rsheader).- A later month of a future is refused, because
pricehistoryanswers the front whatever month is asked (measured 2026-11-04, plugin page, Data).
- Tier off one probe.
mktDataPermissionreadsNPin every sample and names a subscriber class, not a tier. So on bind,probe_tierasks/quotesforAAPL,$SPXand/ESand seats each class's grant from itsrealtimeflag. A delayed class is late 15 minutes, or 10 for CME futures. - A live minute forms between chart rows. A
CHART_EQUITYrow lands about 3 s past its minute (measured). SoFormingbuilds 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
screenerhotlists, and a future root's months servesearch. 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/drawsschwab-market. - A write under
/trader/v1/accounts/<hash>/draws that account'sschwab-orders <hash>, a 120-a-minute window that refuses unsent once full. - Everything else draws
schwab-account. marketandaccountcount but refuse nothing, because Schwab publishes no read limit. A 429 holds the budget it hit forHOLD, 4 s, since Schwab sends noRetry-After. Later sends on that budget are refused unsent withRateLimiteduntil 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, andplacereads back. - Nothing is resent on a 429.
- The hub sends at most
REACH_SHARE, 16, bar requests at once for one reach.
- A path under
- Token life.
TokenStore::tokenrefreshes insideREFRESH_MARGIN_SECS, 5 minutes. A burst of callers waits on one mint turn and sends one POST.refresh_if_stillrefreshes after a 401 only if no other store already replaced the rejected token.- A refusal naming
invalid_grant,invalid_clientorrefresh_token_authentication_error, at the outer level or nested inerror_description, setsrelink. From then on nothing is sent, andSource::expiredreports 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.
- A refusal naming
- Streamer. One
SchwabStreamper 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 readsuserPreference, dials, presents the token inLOGIN, 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_DENIEDrefreshes the token and redials.- A
notifywith 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
/quotesentry and tick carries its owndelayed. Each class's grant comes fromprobe_tierat 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@ESorES1!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 (
/NQas/NQZ26), andsymbol::frontreads it back.
- Refusals before HTTP.
order_bodyrefuses every class but equity and option, and every word inDEFERRED.SchwabBars::askrefuses a timeframe Schwab has no candles of and a session other than regular or extended.basisrefuses 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-schwabruns the unit tests: wiremock for REST and the token endpoint, a fake streamer insrc/stream/tests.rs, and every order shape insrc/orders/tests.rs. It also runstests/egress.rs, whose goldens undertests/egress/hold every byte sent.- The code-exchange golden,
tests/egress/exchange.txt, is written by the kernel's OAuth test inengine/crates/taji/src/entitlements/oauth.rs. cargo test -p taji-tradingcovers binding: two Schwab rows on one sign-in sharing its write slot and budgets, inengine/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_KEYandSCHWAB_API_SECRETcome 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 needLIVE_FILLS=1too. 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.shruns the read tests withSCHWAB_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
orderonly reads.orderrefuses unlessWALK_ORDER_YES=1, set only after your person's yes, because it places live orders. liveruns 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. linkandaccountswere walked on 2026-10-08; every other phase is not yet walked.
References
Each was fetched 2026-12-02.
- Schwab Developer Portal, Trader API – Individual (shown only to a signed-in browser): https://developer.schwab.com/products/trader-api--individual
- portal, Accounts and Trading: OAuth, order samples, the order throttle
- portal, Accounts and Trading spec
- portal, Market Data spec
- portal, Streamer
- schwab-py:
- Measured facts, access and open items: the plugin page. Coverage cells: Schwab coverage.