trade_history
Retrieve historical trade data for specific stock symbols to analyze past transactions and market activity.
Instructions
Return the trade history for a specific stock symbol.
Args: symbol: The stock ticker symbol (e.g., AMZN, MSFT)
Returns: A list of dictionaries containing all trade records for that symbol.
Example: trade_history("GOOG") -> [{"date": "2024-01-01", "type": "Buy", ...}, ...]
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- trader_tools.py:203-215 (handler)The tool `trade_history` is defined and implemented here, using `mcp.tool()` to register it. It filters the global `df` (loaded from `TRADE_CSV_PATH`) for a specific stock symbol and returns the records as a list of dictionaries.
def trade_history(symbol: str) -> list[dict[str, Any]]: """Return the trade history for a specific stock symbol. Args: symbol: The stock ticker symbol (e.g., AMZN, MSFT) Returns: A list of dictionaries containing all trade records for that symbol. Example: trade_history("GOOG") -> [{"date": "2024-01-01", "type": "Buy", ...}, ...] """ return df[df['symbol'] == symbol].to_dict(orient='records')