Streaming
Schwab Streaming Client
Schwab Streaming Overview
To access real-time data from Schwab, you can use the various level_one
and book
methods provided in the Schwab client. These methods allow you to:
Subscribe (
SUBS
) to real-time updates.Unsubscribe (
UNSUBS
) from real-time updates.Add (
ADD
) additional instruments to an existing stream.View (
VIEW
) the current state of the stream.
Each streaming request requires the following:
Keys: Ticker symbols or specific keys for the instrument (e.g.,
"AAPL"
,"/ESF24"
).Fields: The data points you wish to receive (e.g., price, volume).
Command: The action to perform (e.g.,
"SUBS"
to subscribe,"UNSUBS"
to unsubscribe).
Method: basic_request
All streaming requests are built upon the basic_request
method, which sends the stream commands to Schwab’s servers.
Streaming Methods
Method: level_one_equities
Streams level one data (quotes and basic fields) for equities.
Arguments:
keys (
list | str
): A list of ticker symbols (e.g.,["AMD", "INTC"]
) or a single ticker symbol.fields (
list | str
): A list of data fields you want to stream (e.g.,["0", "1", "2"]
).command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
. (Add will append and SUBS will override)
Example:
Method: level_one_options
Streams level one data for options, including calls and puts.
Arguments:
keys (
list | str
): A list of option identifiers (e.g.,["GOOG 240809C00095000", "AAPL 240517P00190000"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Method: level_one_futures
Streams level one data for futures contracts.
Arguments:
keys (
list | str
): A list of futures contracts (e.g.,["/ESF24", "/GCG24"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Method: level_one_forex
Streams level one data for forex pairs.
Arguments:
keys (
list | str
): A list of forex pairs (e.g.,["EUR/USD", "JPY/USD"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Method: options_book
Streams real-time order book data for options.
Arguments:
keys (
list | str
): A list of options identifiers (e.g.,["AAPL 240517P00190000"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Chart Data Streaming
Method: chart_equity
Streams real-time chart data for equities, such as tick-by-tick price movements and volume.
Arguments:
keys (
list | str
): A list of ticker symbols (e.g.,["AAPL", "MSFT"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Method: chart_futures
Streams real-time chart data for futures contracts.
Arguments:
keys (
list | str
): A list of futures contracts (e.g.,["/ESF24", "/GCG24"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Screener Streaming
Method: screener_equity
Streams real-time equity screener data based on specified filters such as volume, trades, and percent change.
Arguments:
keys (
list | str
): A list of screener filters (e.g.,["$DJI_PERCENT_CHANGE_UP_60", "NASDAQ_VOLUME_30"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Method: screener_options
Streams real-time options screener data based on specified filters such as volume and percent change.
Arguments:
keys (
list | str
): A list of screener filters (e.g.,["OPTION_PUT_PERCENT_CHANGE_UP_60"]
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
,"ADD"
,"VIEW"
). Default is"ADD"
.
Example:
Account Activity Streaming
Method: account_activity
Streams real-time account activity, such as trades, orders, and balance updates.
Arguments:
keys (
list | str
): A list of keys to track account activity (default is"Account Activity"
).fields (
list | str
): A list of data fields to stream.command (
str
): The action to perform (e.g.,"SUBS"
,"UNSUBS"
). Default is"SUBS"
.
Example:
Streaming Command Explanation
SUBS: Subscribe to a stream for the provided keys and fields.
UNSUBS: Unsubscribe from the stream for the provided keys and fields.
ADD: Add new instruments or fields to an existing subscription.
VIEW: View the current stream for the provided keys and fields.
Last updated