get_quote_history_price
Retrieve historical stock price data for Vietnamese securities by specifying symbol, date range, and time interval 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.DataFrame
Input 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 core handler function for the 'get_quote_history_price' MCP tool. It is decorated with @server.tool() which also serves as registration. Fetches historical stock price data using vnstock.Quote.history() based on symbol, date range, and interval, then returns 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.@server.tool()
- src/vnstock_mcp/server.py:675-681 (schema)Type hints and docstring define the input schema for the tool parameters.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