Skip to main content
Glama
Alexander-Panov

Finam MCP Server

market_data_get_order_book

Retrieve current order book data for financial instruments on Russian markets to analyze bid-ask spreads and market depth.

Instructions

Получение текущего стакана по инструменту

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYessymbol в формате: SYMBOL@MIC (например, YDEX@MISX)

Implementation Reference

  • The handler function `get_order_book` that implements the core logic of fetching the order book data for a given symbol via the Finam client. Due to the 'market_data' prefix on the MCP server, the tool is exposed as 'market_data_get_order_book'.
    @market_data_mcp.tool(tags={"market_data"}) async def get_order_book(symbol: Symbol) -> OrderBookResponse: """Получение текущего стакана по инструменту""" return await get_finam_client().get_order_book(symbol)
  • src/main.py:13-13 (registration)
    Registers the market_data_mcp server under the 'market_data' prefix, which prefixes all its tools including 'get_order_book' to become 'market_data_get_order_book'.
    finam_mcp.mount(market_data_mcp, prefix="market_data")
  • Pydantic schema for the 'symbol' input parameter used in the tool, providing validation, description, and examples.
    Symbol: type[str] = Annotated[ str, Field( description="symbol в формате: SYMBOL@MIC (например, YDEX@MISX)", pattern=r"^[A-Z0-9]+@[A-Z]+$", # Regex валидация examples=["YDEX@MISX", "SBER@TQBR"] ) ]
  • Utility function to retrieve the FinamClient instance from the MCP context, used by the handler.
    def get_finam_client() -> FinamClient: return get_context().get_state("finam_client")
  • Registers the 'get_order_book' function as an MCP tool on the market_data_mcp server with 'market_data' tag.
    @market_data_mcp.tool(tags={"market_data"})

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/Alexander-Panov/finam-mcp'

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