← Back to all apps

Alpaca

Finance
Open in ChatGPT →

Market data: stocks & crypto

22Tools
FinanceCategory

Available Tools

Alpaca provides 22 tools that can be used to interact with its services.

Get All Assets

get_all_assets
Full Description

Get all available assets with optional filtering.

Args: status: Filter by asset status (e.g., 'active', 'inactive') asset_class: Filter by asset class (e.g., 'us_equity', 'crypto') exchange: Filter by exchange (e.g., 'NYSE', 'NASDAQ') attributes: Comma-separated values to query for multiple attributes

Parameters

Optional
asset_classstring
Default: null
attributesstring
Default: null
exchangestring
Default: null
statusstring
Default: null

Get Asset

get_asset
Full Description

Retrieves and formats detailed information about a specific asset.

Args: symbol (str): The symbol of the asset to get information for

Returns: str: Formatted string containing asset details including:

  • Name
  • Exchange
  • Class
  • Status
  • Trading Properties

Parameters

Required
symbolstring

Get Calendar

get_calendar
Full Description

Retrieves and formats market calendar for specified date range.

Args: start_date (str): Start date in YYYY-MM-DD format end_date (str): End date in YYYY-MM-DD format

Returns: str: Formatted string containing market calendar information

Parameters

Required
end_datestring
start_datestring

Get Clock

get_clock
Full Description

Retrieves and formats current market status and next open/close times.

Returns: str: Formatted string containing:

  • Current Time
  • Market Open Status
  • Next Open Time
  • Next Close Time

Get Corporate Actions

get_corporate_actions
Full Description

Retrieves and formats corporate action announcements.

Args: ca_types (Optional[List[CorporateActionsType]]): List of corporate action types to filter by (default: all types) Available types from https://alpaca.markets/sdks/python/api_reference/data/enums.html#corporateactionstype:

  • CorporateActionsType.REVERSE_SPLIT: Reverse split
  • CorporateActionsType.FORWARD_SPLIT: Forward split
  • CorporateActionsType.UNIT_SPLIT: Unit split
  • CorporateActionsType.CASH_DIVIDEND: Cash dividend
  • CorporateActionsType.STOCK_DIVIDEND: Stock dividend
  • CorporateActionsType.SPIN_OFF: Spin off
  • CorporateActionsType.CASH_MERGER: Cash merger
  • CorporateActionsType.STOCK_MERGER: Stock merger
  • CorporateActionsType.STOCK_AND_CASH_MERGER: Stock and cash merger
  • CorporateActionsType.REDEMPTION: Redemption
  • CorporateActionsType.NAME_CHANGE: Name change
  • CorporateActionsType.WORTHLESS_REMOVAL: Worthless removal
  • CorporateActionsType.RIGHTS_DISTRIBUTION: Rights distribution

start (Optional[date]): Start date for the announcements (default: current day) end (Optional[date]): End date for the announcements (default: current day) symbols (Optional[List[str]]): Optional list of stock symbols to filter by cusips (Optional[List[str]]): Optional list of CUSIPs to filter by ids (Optional[List[str]]): Optional list of corporate action IDs (mutually exclusive with other filters) limit (Optional[int]): Maximum number of results to return (default: 1000) sort (Optional[str]): Sort order (asc or desc, default: asc)

Returns: str: Formatted string containing corporate announcement details

References:

  • API Documentation: https://docs.alpaca.markets/reference/corporateactions-1
  • CorporateActionsType Enum: https://alpaca.markets/sdks/python/api_reference/data/enums.html#corporateactionstype
  • CorporateActionsRequest: https://alpaca.markets/sdks/python/api_reference/data/corporate_actions/requests.html#corporateactionsrequest

Parameters

Optional
ca_typesarray
Default: null
cusipsarray
Default: null
endstring
Default: null
idsarray
Default: null
limitinteger
Default: 1000
sortstring
Default: asc
startstring
Default: null
symbolsarray
Default: null

Get Crypto Bars

get_crypto_bars
Full Description

Retrieves and formats historical price bars for a cryptocurrency with configurable timeframe and time range.

Args: symbol (Union[str, List[str]]): Crypto symbol(s) (e.g., 'BTC/USD', 'ETH/USD' or ['BTC/USD', 'ETH/USD']) days (int): Number of days to look back (default: 1, ignored if start/end provided) timeframe (str): Bar timeframe - supports flexible Alpaca formats:

  • Minutes: "1Min", "2Min", "3Min", "4Min", "5Min", "15Min", "30Min", etc.
  • Hours: "1Hour", "2Hour", "3Hour", "4Hour", "6Hour", etc.
  • Days: "1Day", "2Day", "3Day", etc.
  • Weeks: "1Week", "2Week", etc.
  • Months: "1Month", "2Month", etc.

(default: "1Hour") limit (Optional[int]): Maximum number of bars to return (optional) start (Optional[str]): Start time in ISO format (e.g., "2023-01-01T09:30:00" or "2023-01-01") end (Optional[str]): End time in ISO format (e.g., "2023-01-01T16:00:00" or "2023-01-01") feed (CryptoFeed): The crypto data feed to retrieve from (default: US)

Returns: str: Formatted string containing historical crypto price data with timestamps, OHLCV data

Parameters

Required
symbolstring
Optional
daysinteger
Default: 1
endstring
Default: null
feed
Default: us
limitinteger
Default: null
startstring
Default: null
timeframestring
Default: 1Hour

Get Crypto Latest Bar

get_crypto_latest_bar
Full Description

Returns the latest minute bar for one or more crypto symbols.

Parameters

Required
symbolstring
Optional
feed
Default: us

Get Crypto Latest Orderbook

get_crypto_latest_orderbook
Full Description

Returns the latest orderbook for one or more crypto symbols.

Parameters

Required
symbolstring
Optional
feed
Default: us

Get Crypto Latest Quote

get_crypto_latest_quote
Full Description

Returns the latest quote for one or more crypto symbols.

Args: symbol (Union[str, List[str]]): Crypto symbol(s) (e.g., 'BTC/USD' or ['BTC/USD','ETH/USD']) feed (CryptoFeed): The crypto data feed (default: US)

Returns: str: Formatted latest quote(s)

Parameters

Required
symbolstring
Optional
feed
Default: us

Get Crypto Latest Trade

get_crypto_latest_trade
Full Description

Returns the latest trade for one or more crypto symbols.

Parameters

Required
symbolstring
Optional
feed
Default: us

Get Crypto Quotes

get_crypto_quotes
Full Description

Retrieves and formats historical quote data for a cryptocurrency.

Args: symbol (Union[str, List[str]]): Crypto symbol(s) (e.g., 'BTC/USD', 'ETH/USD' or ['BTC/USD', 'ETH/USD']) days (int): Number of days to look back (default: 3, ignored if start/end provided) limit (Optional[int]): Maximum number of quotes to return (optional) start (Optional[str]): Start time in ISO format (e.g., "2023-01-01T09:30:00" or "2023-01-01") end (Optional[str]): End time in ISO format (e.g., "2023-01-01T16:00:00" or "2023-01-01") feed (CryptoFeed): The crypto data feed to retrieve from (default: US)

Returns: str: Formatted string containing historical crypto quote data with timestamps, bid/ask prices and sizes

Parameters

Required
symbolstring
Optional
daysinteger
Default: 3
endstring
Default: null
feed
Default: us
limitinteger
Default: null
startstring
Default: null

Get Crypto Snapshot

get_crypto_snapshot
Full Description

Returns a snapshot for one or more crypto symbols including latest trade, quote, latest minute bar, daily and previous daily bars.

Parameters

Required
symbolstring
Optional
feed
Default: us

Get Crypto Trades

get_crypto_trades
Full Description

Retrieves and formats historical trade prints for a cryptocurrency.

Args: symbol (Union[str, List[str]]): Crypto symbol(s) (e.g., 'BTC/USD' or ['BTC/USD','ETH/USD']) days (int): Number of days to look back (default: 1, ignored if start/end provided) limit (Optional[int]): Maximum number of trades to return start (Optional[str]): ISO start time (e.g., "2023-01-01T09:30:00") end (Optional[str]): ISO end time (e.g., "2023-01-01T16:00:00") sort (Optional[str]): 'asc' or 'desc' chronological order feed (CryptoFeed): Crypto data feed (default: US)

Returns: str: Formatted trade history

Parameters

Required
symbolstring
Optional
daysinteger
Default: 1
endstring
Default: null
feed
Default: us
limitinteger
Default: null
sortstring
Default: null
startstring
Default: null

Get Option Contracts

get_option_contracts
Full Description

Retrieves option contracts - direct mapping to GetOptionContractsRequest.

Args: underlying_symbol (str): Underlying asset symbol (e.g., 'SPY', 'AAPL') expiration_date (Optional[date]): Specific expiration date expiration_date_gte (Optional[date]): Expiration date greater than or equal to expiration_date_lte (Optional[date]): Expiration date less than or equal to expiration_expression (Optional[str]): Natural language (e.g., "week of September 2, 2025") strike_price_gte/lte (Optional[str]): Strike price range type (Optional[ContractType]): "call" or "put" status (Optional[AssetStatus]): "active" (default) root_symbol (Optional[str]): Root symbol filter limit (Optional[int]): Maximum number of contracts to return

Examples: get_option_contracts("NVDA", expiration_expression="week of September 2, 2025") get_option_contracts("SPY", expiration_date_gte=date(2025,9,1), expiration_date_lte=date(2025,9,5))

Parameters

Required
underlying_symbolstring
Optional
expiration_datestring
Default: null
expiration_date_gtestring
Default: null
expiration_date_ltestring
Default: null
expiration_expressionstring
Default: null
limitinteger
Default: null
root_symbolstring
Default: null
status
Default: null
strike_price_gtestring
Default: null
strike_price_ltestring
Default: null
type
Default: null

Get Option Latest Quote

get_option_latest_quote
Full Description

Retrieves and formats the latest quote for an option contract. This endpoint returns real-time pricing and market data, including bid/ask prices, sizes, and exchange information.

Args: symbol (str): The option contract symbol (e.g., 'AAPL230616C00150000') feed (Optional[OptionsFeed]): The source feed of the data (opra or indicative). Default: opra if the user has the options subscription, indicative otherwise.

Returns: str: Formatted string containing the latest quote information including:

  • Ask Price and Ask Size
  • Bid Price and Bid Size
  • Ask Exchange and Bid Exchange
  • Trade Conditions
  • Tape Information
  • Timestamp (in UTC)

Note: This endpoint returns real-time market data. For contract specifications and static data, use get_option_contracts instead.

Parameters

Required
symbolstring
Optional
feed
Default: null

Get Option Snapshot

get_option_snapshot
Full Description

Retrieves comprehensive snapshots of option contracts including latest trade, quote, implied volatility, and Greeks. This endpoint provides a complete view of an option's current market state and theoretical values.

Args: symbol_or_symbols (Union[str, List[str]]): Single option symbol or list of option symbols (e.g., 'AAPL250613P00205000') feed (Optional[OptionsFeed]): The source feed of the data (opra or indicative). Default: opra if the user has the options subscription, indicative otherwise.

Returns: str: Formatted string containing a comprehensive snapshot including:

  • Symbol Information
  • Latest Quote:
    • Bid/Ask Prices and Sizes
    • Exchange Information
    • Trade Conditions
    • Tape Information
    • Timestamp (UTC)
  • Latest Trade:
    • Price and Size
    • Exchange and Conditions
    • Trade ID
    • Timestamp (UTC)
    • Implied Volatility (as percentage)
  • Greeks:
    • Delta (directional risk)
    • Gamma (delta sensitivity)
    • Rho (interest rate sensitivity)
    • Theta (time decay)
    • Vega (volatility sensitivity)

Parameters

Required
symbol_or_symbolsstring
Optional
feed
Default: null

Get Stock Bars

get_stock_bars
Full Description

Retrieves and formats historical price bars for a stock with configurable timeframe and time range.

Args: symbol (str): Stock ticker symbol (e.g., AAPL, MSFT) days (int): Number of days to look back (default: 5, ignored if start/end provided) timeframe (str): Bar timeframe - supports flexible Alpaca formats:

  • Minutes: "1Min", "2Min", "3Min", "4Min", "5Min", "15Min", "30Min", etc.
  • Hours: "1Hour", "2Hour", "3Hour", "4Hour", "6Hour", etc.
  • Days: "1Day", "2Day", "3Day", etc.
  • Weeks: "1Week", "2Week", etc.
  • Months: "1Month", "2Month", etc.

(default: "1Day") limit (Optional[int]): Maximum number of bars to return (optional) start (Optional[str]): Start time in ISO format (e.g., "2023-01-01T09:30:00" or "2023-01-01") end (Optional[str]): End time in ISO format (e.g., "2023-01-01T16:00:00" or "2023-01-01")

Returns: str: Formatted string containing historical price data with timestamps, OHLCV data

Parameters

Required
symbolstring
Optional
daysinteger
Default: 5
endstring
Default: null
limitinteger
Default: null
startstring
Default: null
timeframestring
Default: 1Day

Get Stock Latest Bar

get_stock_latest_bar
Full Description

Get the latest minute bar for a stock.

Args: symbol: Stock ticker symbol (e.g., 'AAPL', 'MSFT') feed: The stock data feed to retrieve from (optional) currency: The currency for prices (optional, defaults to USD)

Returns: A formatted string containing the latest bar details or an error message

Parameters

Required
symbolstring
Optional
currency
Default: null
feed
Default: null

Get Stock Latest Quote

get_stock_latest_quote
Full Description

Retrieves and formats the latest quote for one or more stocks.

Args: symbol_or_symbols (Union[str, List[str]]): Single stock ticker symbol (e.g., "AAPL") or a list of symbols (e.g., ["AAPL", "MSFT"]).

Returns: str: Formatted string containing for each requested symbol:

  • Ask Price
  • Bid Price
  • Ask Size
  • Bid Size
  • Timestamp

Parameters

Required
symbol_or_symbolsstring

Get Stock Latest Trade

get_stock_latest_trade
Full Description

Get the latest trade for a stock.

Args: symbol: Stock ticker symbol (e.g., 'AAPL', 'MSFT') feed: The stock data feed to retrieve from (optional) currency: The currency for prices (optional, defaults to USD)

Returns: A formatted string containing the latest trade details or an error message

Parameters

Required
symbolstring
Optional
currency
Default: null
feed
Default: null

Get Stock Snapshot

get_stock_snapshot
Full Description

Retrieves comprehensive snapshots of stock symbols including latest trade, quote, minute bar, daily bar, and previous daily bar.

Args: symbol_or_symbols: Single stock symbol or list of stock symbols (e.g., 'AAPL' or ['AAPL', 'MSFT']) feed: The stock data feed to retrieve from (optional) currency: The currency the data should be returned in (default: USD)

Returns: Formatted string with comprehensive snapshots including:

  • latest_quote: Current bid/ask prices and sizes
  • latest_trade: Most recent trade price, size, and exchange
  • minute_bar: Latest minute OHLCV bar
  • daily_bar: Current day's OHLCV bar
  • previous_daily_bar: Previous trading day's OHLCV bar

Parameters

Required
symbol_or_symbolsstring
Optional
currency
Default: null
feed
Default: null

Get Stock Trades

get_stock_trades
Full Description

Retrieves and formats historical trades for a stock.

Args: symbol (str): Stock ticker symbol (e.g., 'AAPL', 'MSFT') days (int): Number of days to look back (default: 5) limit (Optional[int]): Upper limit of number of data points to return sort (Optional[Sort]): Chronological order of response (ASC or DESC) feed (Optional[DataFeed]): The stock data feed to retrieve from currency (Optional[SupportedCurrencies]): Currency for prices (default: USD) asof (Optional[str]): The asof date in YYYY-MM-DD format

Returns: str: Formatted string containing trade history or an error message

Parameters

Required
symbolstring
Optional
asofstring
Default: null
currency
Default: null
daysinteger
Default: 5
feed
Default: null
limitinteger
Default: null
sort
Default: asc