get_earning_dates
Retrieve upcoming and historical earnings announcement dates for stocks to track corporate financial reporting schedules.
Instructions
Get earning dates.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock symbol in Yahoo Finance format. | |
| limit | No | max amount of upcoming and recent earnings dates to return. Default value 12 should return next 4 quarters and last 8 quarters. Increase if more history is needed. |
Implementation Reference
- src/mcp_yahoo_finance/server.py:286-294 (handler)The MCP tool handler for 'get_earning_dates', registered via @mcp_instance.tool() decorator. It delegates execution to the YahooFinance class instance method.@mcp_instance.tool() def get_earning_dates(symbol: str, limit: int = 12) -> str: """Get earning dates. Args: symbol (str): Stock symbol in Yahoo Finance format. limit (int): max amount of upcoming and recent earnings dates to return. Default value 12 should return next 4 quarters and last 8 quarters. Increase if more history is needed. """ return yf_instance.get_earning_dates(symbol, limit)
- Core implementation of earnings dates retrieval in the YahooFinance class using yfinance library. Fetches data with Ticker.get_earnings_dates() and formats as JSON string.def get_earning_dates(self, symbol: str, limit: int = 12) -> str: """Get earning dates. Args: symbol (str): Stock symbol in Yahoo Finance format. limit (int): max amount of upcoming and recent earnings dates to return. Default value 12 should return next 4 quarters and last 8 quarters. Increase if more history is needed. """ stock = Ticker(ticker=symbol, session=self.session) earning_dates = stock.get_earnings_dates(limit=limit) if isinstance(earning_dates, pd.DataFrame): earning_dates.index = earning_dates.index.date.astype(str) # type: ignore return f"{earning_dates.to_json(indent=2)}" return f"{earning_dates}"