Skip to content

Core stock tools

core_stock_tools

Functions:

Name Description
get_stock_data

Retrieve stock price data (OHLCV) for a given ticker symbol.

get_stock_data

get_stock_data(symbol: str, start_date: str, end_date: str) -> str

Retrieve stock price data (OHLCV) for a given ticker symbol.

Parameters:

Name Type Description Default

symbol

str

Stock ticker, company symbol, or Taiwan stock code. Examples: AAPL, TSM, 2330.TW, 2330, 8069.

required

start_date

str

Start date in YYYY-MM-DD format.

required

end_date

str

End date in YYYY-MM-DD format.

required

Returns:

Name Type Description
str str

CSV-formatted OHLCV data with a short metadata header, or a no-data message if no Yahoo Finance candidate has price history.

Source code in src/tradingagents/agents/utils/core_stock_tools.py
@tool
def get_stock_data(
    symbol: Annotated[str, "ticker symbol of the company"],
    start_date: Annotated[str, "Start date in yyyy-mm-dd format"],
    end_date: Annotated[str, "End date in yyyy-mm-dd format"],
) -> str:
    """Retrieve stock price data (OHLCV) for a given ticker symbol.

    Args:
        symbol (str): Stock ticker, company symbol, or Taiwan stock code.
            Examples: AAPL, TSM, 2330.TW, 2330, 8069.
        start_date (str): Start date in YYYY-MM-DD format.
        end_date (str): End date in YYYY-MM-DD format.

    Returns:
        str: CSV-formatted OHLCV data with a short metadata header, or a
            no-data message if no Yahoo Finance candidate has price history.
    """
    return get_yfin_data_online(symbol, start_date, end_date)