Skip to main content
Glama
ariesanhthu

VNStock MCP Server

by ariesanhthu

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.DataFrame

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
start_dateYes
end_dateNo
intervalNo1D
output_formatNojson

Implementation Reference

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

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