Skip to content

News data tools

news_data_tools

Functions:

Name Description
get_news

Retrieve news data for a given ticker symbol.

get_global_news

Retrieve global news data.

get_insider_transactions

Retrieve insider transaction information about a company.

get_news

get_news(ticker: str, start_date: str, end_date: str) -> str

Retrieve news data for a given ticker symbol.

Parameters:

Name Type Description Default

ticker

str

Ticker symbol.

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

A formatted news report, a no-data message, or an error message.

Source code in src/tradingagents/agents/utils/news_data_tools.py
@tool
def get_news(
    ticker: Annotated[str, "Ticker symbol"],
    start_date: Annotated[str, "Start date in yyyy-mm-dd format"],
    end_date: Annotated[str, "End date in yyyy-mm-dd format"],
) -> str:
    """Retrieve news data for a given ticker symbol.

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

    Returns:
        str: A formatted news report, a no-data message, or an error message.
    """
    return get_news_yfinance(ticker, start_date, end_date)

get_global_news

get_global_news(curr_date: str, look_back_days: int = 7, limit: int = 5) -> str

Retrieve global news data.

Parameters:

Name Type Description Default

curr_date

str

Current date in YYYY-MM-DD format.

required

look_back_days

int

Number of days used for the report window label. Defaults to 7.

7

limit

int

Maximum number of articles to return. Defaults to 5.

5

Returns:

Name Type Description
str str

A formatted global news report, a no-data message, or an error message.

Source code in src/tradingagents/agents/utils/news_data_tools.py
@tool
def get_global_news(
    curr_date: Annotated[str, "Current date in yyyy-mm-dd format"],
    look_back_days: Annotated[int, "Number of days to look back"] = 7,
    limit: Annotated[int, "Maximum number of articles to return"] = 5,
) -> str:
    """Retrieve global news data.

    Args:
        curr_date (str): Current date in YYYY-MM-DD format.
        look_back_days (int, optional): Number of days used for the report
            window label. Defaults to 7.
        limit (int, optional): Maximum number of articles to return. Defaults
            to 5.

    Returns:
        str: A formatted global news report, a no-data message, or an error message.
    """
    return get_global_news_yfinance(curr_date, look_back_days, limit)

get_insider_transactions

get_insider_transactions(ticker: str, curr_date: str | None = None) -> str

Retrieve insider transaction information about a company.

Parameters:

Name Type Description Default

ticker

str

Ticker symbol of the company.

required

curr_date

str | None

Current trading date used as a point-in-time boundary. Defaults to None.

None

Returns:

Name Type Description
str str

CSV-formatted insider transaction data, a no-data message, or an error message.

Source code in src/tradingagents/agents/utils/news_data_tools.py
@tool
def get_insider_transactions(
    ticker: Annotated[str, "ticker symbol"],
    curr_date: Annotated[str | None, "current date in yyyy-mm-dd format"] = None,
) -> str:
    """Retrieve insider transaction information about a company.

    Args:
        ticker (str): Ticker symbol of the company.
        curr_date (str | None, optional): Current trading date used as a
            point-in-time boundary. Defaults to None.

    Returns:
        str: CSV-formatted insider transaction data, a no-data message, or an
            error message.
    """
    return _get_insider_transactions(ticker, curr_date)