Market Data
Schwab Market Data Prouction
Market Data Operations
The Schwab API provides extensive market data functionality, allowing you to retrieve real-time quotes, historical price data, options chains, market movers, and instrument details.
Method: quotes
quotes
Fetches real-time quotes for a list of ticker symbols.
Usage:
Parameters:
symbols (
str | list[str]
, optional): A comma-separated string or list of ticker symbols (e.g.,"AAPL,MSFT"
or["AAPL", "MSFT"]
). Default isNone
.fields (
list
, optional): A list of fields to include in the response (e.g.,"quote"
,"fundamental"
). Default isNone
, which fetches all available fields.indicative (
bool
, optional): Whether to retrieve indicative quotes. Default isFalse
.
Returns:
A
request.Response
object containing the quotes for the requested symbols.
Example:
Method: quote
quote
Fetches a real-time quote for a single ticker symbol.
Usage:
Parameters:
symbol_id (
str
): The stock ticker symbol (e.g.,"AAPL"
,"/ES"
,"USD/EUR"
).fields (
list
, optional): A list of fields to include in the response (e.g.,"quote"
,"fundamental"
). Default isNone
, which fetches all available fields.
Returns:
A
request.Response
object containing the quote for the requested symbol.
Example:
Method: option_chains
option_chains
Fetches the options chain for a specific ticker symbol, including both calls and puts for different expirations.
Usage:
Parameters:
symbol (
str
): The ticker symbol (e.g.,"AAPL"
).contractType (
str
, optional): The type of options contracts to retrieve ("CALL"
,"PUT"
, or"ALL"
). Default isNone
.strikeCount (
int
, optional): The number of strikes to retrieve. Default isNone
.includeUnderlyingQuote (
bool
, optional): Whether to include the underlying stock's quote. Default isNone
.strategy (
str
, optional): Option strategy to use (e.g.,"SINGLE"
,"COVERED"
). Default isNone
.interval (
str
, optional): The strike price interval. Default isNone
.strike (
float
, optional): The specific strike price. Default isNone
.range (
str
, optional): Range filter for strike prices (e.g.,"ITM"
,"OTM"
). Default isNone
.fromDate (
str | datetime
, optional): Start date for the option chain. Default isNone
.toDate (
str | datetime
, optional): End date for the option chain. Default isNone
.volatility (
float
, optional): Implied volatility for the options. Default isNone
.underlyingPrice (
float
, optional): Underlying price for the options. Default isNone
.interestRate (
float
, optional): Interest rate for the options. Default isNone
.daysToExpiration (
int
, optional): Number of days to expiration for the options. Default isNone
.expMonth (
str
, optional): Expiration month ("JAN"
,"FEB"
, etc.). Default isNone
.optionType (
str
, optional): Option type ("CALL"
,"PUT"
). Default isNone
.entitlement (
str
, optional): Entitlement type ("PN"
,"NP"
,"PP"
). Default isNone
.
Returns:
A
request.Response
object containing the options chain.
Example:
Method: option_expiration_chain
option_expiration_chain
Fetches the expiration dates for options of a specific ticker symbol.
Usage:
Parameters:
symbol (
str
): The ticker symbol for which to retrieve the options expiration chain (e.g.,"AAPL"
).
Returns:
A
request.Response
object containing the expiration chain for the symbol.
Example:
Method: price_history
price_history
Fetches the historical price data for a specific stock or symbol.
Usage:
Parameters:
symbol (
str
): The stock ticker symbol (e.g.,"AAPL"
).periodType (
str
, optional): The type of period to retrieve (e.g.,"day"
,"month"
,"year"
,"ytd"
). Default isNone
.period (
int
, optional): The length of the period (e.g.,5
days,1
month). Default isNone
.frequencyType (
str
, optional): The frequency of data points (e.g.,"minute"
,"daily"
,"weekly"
). Default isNone
.frequency (
int
, optional): The number of minutes or days between each data point. Default isNone
.startDate (
str | datetime
, optional): The start date for the price history. Default isNone
.endDate (
str | datetime
, optional): The end date for the price history. Default isNone
.needExtendedHoursData (
bool
, optional): Whether to include extended trading hours. Default isFalse
.needPreviousClose (
bool
, optional): Whether to include the previous closing price. Default isFalse
.
Returns:
A
request.Response
object containing the price history data.
Example:
Method: movers
movers
Fetches the top movers in a specific index, such as the Dow Jones or NASDAQ, with options to sort by various metrics.
Usage:
Parameters:
symbol (
str
): The index symbol (e.g.,"$DJI"
,"$COMPX"
,"$SPX"
).sort (
str
, optional): Sorting criteria (e.g.,"VOLUME"
,"TRADES"
,"PERCENT_CHANGE_UP"
,"PERCENT_CHANGE_DOWN"
). Default isNone
.frequency (
int
, optional): The frequency of updates (e.g.,1
,5
,10
,30
,60
minutes). Default isNone
.
Returns:
A
request.Response
object containing the top movers in the specified index.
Example:
Method: market_hours
market_hours
Fetches the market hours for specific symbols and dates across different asset classes, such as equities, options, bonds, futures, and forex.
Usage:
Parameters:
symbols (
list
, optional): A list of market symbols (e.g.,["equity", "option", "bond", "future", "forex"]
). Default isNone
.date (
str | datetime
, optional): The date for which to retrieve market hours. Default isNone
.
Returns:
A
request.Response
object containing the market hours.
Example:
Method: instruments
instruments
Fetches instrument details for a list of symbols based on a projection type (e.g., symbol search or fundamental data).
Usage:
Parameters:
symbol (
str
): The stock ticker symbol (e.g.,"AAPL"
).projection (
str
): The projection type (e.g.,"symbol-search"
,"fundamental"
).
Returns:
A
request.Response
object containing instrument details.
Example:
Method: instrument_cusip
instrument_cusip
Fetches the details for an instrument based on its CUSIP (Committee on Uniform Securities Identification Procedures) ID.
Usage:
Parameters:
cusip_id (
str | int
): The CUSIP ID of the instrument.
Returns:
A
request.Response
object containing the instrument details for the provided CUSIP ID.
Example:
Last updated