get_quote_history_price
Retrieve historical stock price data for Vietnam market symbols within specified date ranges and intervals to analyze market trends.
Instructions
Get quote price history of a symbol from stock market
Args:
symbol: str (symbol to get history price)
start_date: str (format: YYYY-MM-DD)
end_date: str = None (end date to get history price. None means today)
interval: Literal['1m', '5m', '15m', '30m', '1H', '1D', '1W', '1M'] = '1D' (interval to get history price)
output_format: Literal['json', 'dataframe'] = 'json'
Returns:
pd.DataFrameInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| start_date | Yes | ||
| end_date | No | ||
| interval | No | 1D | |
| output_format | No | json |
Implementation Reference
- src/vnstock_mcp/server.py:674-702 (handler)The main handler function for the 'get_quote_history_price' tool. Decorated with @server.tool() which registers it in the FastMCP server. Implements the core logic using vnstock.Quote to fetch historical price data and format as JSON or pandas DataFrame.
@server.tool() def get_quote_history_price( symbol: str, start_date: str, end_date: str = None, interval: Literal["1m", "5m", "15m", "30m", "1H", "1D", "1W", "1M"] = "1D", output_format: Literal["json", "dataframe"] = "json", ): # pyright: ignore[reportUndefinedVariable] # noqa: F722 """ Get quote price history of a symbol from stock market Args: symbol: str (symbol to get history price) start_date: str (format: YYYY-MM-DD) end_date: str = None (end date to get history price. None means today) interval: Literal['1m', '5m', '15m', '30m', '1H', '1D', '1W', '1M'] = '1D' (interval to get history price) output_format: Literal['json', 'dataframe'] = 'json' Returns: pd.DataFrame """ quote = Quote(symbol=symbol, source="VCI") df = quote.history( start_date=start_date, end_date=end_date or datetime.now().strftime("%Y-%m-%d"), interval=interval, ) if output_format == "json": return df.to_json(orient="records", force_ascii=False) else: return df - src/vnstock_mcp/server.py:674-674 (registration)The @server.tool() decorator registers the get_quote_history_price function as an MCP tool with the name matching the function name.
@server.tool() - src/vnstock_mcp/server.py:675-681 (schema)Function signature with type annotations defining the input schema for the tool, including parameters and their types/constraints.
def get_quote_history_price( symbol: str, start_date: str, end_date: str = None, interval: Literal["1m", "5m", "15m", "30m", "1H", "1D", "1W", "1M"] = "1D", output_format: Literal["json", "dataframe"] = "json", ): # pyright: ignore[reportUndefinedVariable] # noqa: F722