get_income_statement
Retrieve income statement data for companies by specifying a stock symbol and the number of most recent records needed for financial analysis and reporting.
Instructions
Get company income statement data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recent_n | No | Number of most recent records to return | |
| symbol | Yes | Stock symbol/ticker (e.g. '000001') |
Implementation Reference
- src/akshare_one_mcp/server.py:198-209 (handler)The main handler function for the 'get_income_statement' tool, decorated with @mcp.tool for registration. It fetches the income statement data for a given stock symbol using akshare_one (ako), limits to recent_n rows if specified, and returns the data as JSON string.@mcp.tool def get_income_statement( symbol: Annotated[str, Field(description="Stock symbol/ticker (e.g. '000001')")], recent_n: Annotated[ int | None, Field(description="Number of most recent records to return", ge=1) ] = 10, ) -> str: """Get company income statement data.""" df = ako.get_income_statement(symbol=symbol, source="sina") if recent_n is not None: df = df.head(recent_n) return df.to_json(orient="records") or "[]"