from langchain_core.tools import tool from typing import Annotated from tradingagents.dataflows.interface import route_to_vendor @tool def get_fundamentals( ticker: Annotated[str, "ticker symbol"], curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"], ) -> str: """ Retrieve comprehensive fundamental data for a given ticker symbol. Uses the configured fundamental_data vendor. Args: ticker (str): Ticker symbol of the company curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report containing comprehensive fundamental data """ return route_to_vendor("get_fundamentals", ticker, curr_date) @tool def get_balance_sheet( ticker: Annotated[str, "ticker symbol"], freq: Annotated[str, "reporting frequency: annual/quarterly"] = "quarterly", curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"] = None, ) -> str: """ Retrieve balance sheet data for a given ticker symbol. Uses the configured fundamental_data vendor. Args: ticker (str): Ticker symbol of the company freq (str): Reporting frequency: annual/quarterly (default quarterly) curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report containing balance sheet data """ return route_to_vendor("get_balance_sheet", ticker, freq, curr_date) @tool def get_cashflow( ticker: Annotated[str, "ticker symbol"], freq: Annotated[str, "reporting frequency: annual/quarterly"] = "quarterly", curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"] = None, ) -> str: """ Retrieve cash flow statement data for a given ticker symbol. Uses the configured fundamental_data vendor. Args: ticker (str): Ticker symbol of the company freq (str): Reporting frequency: annual/quarterly (default quarterly) curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report containing cash flow statement data """ return route_to_vendor("get_cashflow", ticker, freq, curr_date) @tool def get_income_statement( ticker: Annotated[str, "ticker symbol"], freq: Annotated[str, "reporting frequency: annual/quarterly"] = "quarterly", curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"] = None, ) -> str: """ Retrieve income statement data for a given ticker symbol. Uses the configured fundamental_data vendor. Args: ticker (str): Ticker symbol of the company freq (str): Reporting frequency: annual/quarterly (default quarterly) curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report containing income statement data """ return route_to_vendor("get_income_statement", ticker, freq, curr_date) @tool def get_analyst_recommendations( ticker: Annotated[str, "ticker symbol"], curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"] = None, ) -> str: """ Retrieve analyst recommendations and recent upgrades/downgrades for a ticker. Returns analyst buy/sell/hold consensus counts and recent rating changes with firm names. Args: ticker (str): Ticker symbol of the company curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report of analyst recommendations and rating changes """ return route_to_vendor("get_analyst_recommendations", ticker, curr_date) @tool def get_earnings_data( ticker: Annotated[str, "ticker symbol"], curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"] = None, ) -> str: """ Retrieve earnings dates and historical EPS data (estimates vs actuals). Returns upcoming earnings dates and EPS surprise history. Args: ticker (str): Ticker symbol of the company curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report of earnings dates and EPS history """ return route_to_vendor("get_earnings_data", ticker, curr_date) @tool def get_institutional_holders( ticker: Annotated[str, "ticker symbol"], curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"] = None, ) -> str: """ Retrieve institutional holders and ownership breakdown for a ticker. Returns top institutional holders, insider vs institutional ownership percentages. Args: ticker (str): Ticker symbol of the company curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report of institutional ownership data """ return route_to_vendor("get_institutional_holders", ticker, curr_date)