Skip to main content
Glama
ariesanhthu

VNStock MCP Server

by ariesanhthu

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
NameRequiredDescriptionDefault
symbolYes
start_dateYes
end_dateNo
intervalNo1D
output_formatNojson

Implementation Reference

  • 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
  • The @server.tool() decorator registers the get_quote_history_price function as an MCP tool.
    @server.tool()
  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ariesanhthu/mcp-server-vietnam-stock-trading'

If you have feedback or need assistance with the MCP directory API, please join our Discord server