get_realtime_data
Fetch real-time stock market data for A, B, and H shares using the eastmoney_direct source to monitor current market prices and trading information.
Instructions
Get real-time stock market data. 'eastmoney_direct' support all A,B,H shares
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | Stock symbol/ticker (e.g. '000001') | |
| source | No | Data source | eastmoney_direct |
Implementation Reference
- src/akshare_one_mcp/server.py:155-167 (handler)The MCP tool handler for get_realtime_data, including registration via @mcp.tool decorator, input schema via Annotated parameters, and the core logic that fetches real-time stock data using akshare_one (ako) library and serializes to JSON.@mcp.tool def get_realtime_data( symbol: Annotated[ str | None, Field(description="Stock symbol/ticker (e.g. '000001')") ] = None, source: Annotated[ Literal["xueqiu", "eastmoney", "eastmoney_direct"], Field(description="Data source"), ] = "eastmoney_direct", ) -> str: """Get real-time stock market data. 'eastmoney_direct' support all A,B,H shares""" df = ako.get_realtime_data(symbol=symbol, source=source) return df.to_json(orient="records") or "[]"
- Input schema definition for the get_realtime_data tool, specifying optional symbol and source parameters with descriptions and allowed values.symbol: Annotated[ str | None, Field(description="Stock symbol/ticker (e.g. '000001')") ] = None, source: Annotated[ Literal["xueqiu", "eastmoney", "eastmoney_direct"], Field(description="Data source"), ] = "eastmoney_direct", ) -> str: