Skip to main content
Glama
Alexander-Panov

Finam MCP Server

order_place

Submit buy or sell orders for financial instruments on Russian markets using market, limit, stop, or multi-leg order types.

Instructions

Выставление биржевой заявки

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderYes

Implementation Reference

  • MCP tool handler for placing orders. Function 'place' is prefixed to 'order_place' via server mount.
    @order_mcp.tool(tags={"order"}, meta={"sensitive": True})
    async def place(order: Order) -> OrderState:
        """Выставление биржевой заявки"""
        return await get_finam_client().place_order(order)
  • Pydantic schema/model for the input 'order' parameter used in the order_place tool.
    class Order(BaseModel):
        """Информация о заявке"""
        symbol: Symbol
        quantity: Decimal = Field(description="Количество в шт.")
        side: Side = Field(description="Сторона (long или short)")
        type: OrderType = Field(description="Тип заявки")
        time_in_force: TimeInForce = Field(TimeInForce.UNSPECIFIED, description="Срок действия заявки")
        limit_price: Decimal | None = Field(None, description="Необходимо для лимитной и стоп лимитной заявки")
        stop_price: Decimal | None = Field(None, description="Необходимо для стоп рыночной и стоп лимитной заявки")
        stop_condition: StopCondition = Field(StopCondition.UNSPECIFIED, description="Необходимо для стоп рыночной и стоп лимитной заявки")
        legs: list[Leg] | None = Field(None, description="Необходимо для мульти лег заявки")
        client_order_id: str | None = Field(None, max_length=20, description="Уникальный идентификатор заявки")
        valid_before: ValidBefore | None = Field(None, description="Срок действия условной заявки")
        comment: str | None = Field(None, max_length=128, description="Метка заявки")
  • src/main.py:15-15 (registration)
    Mounts the order_mcp server with 'order' prefix, transforming tool name 'place' to 'order_place'.
    finam_mcp.mount(order_mcp, prefix="order")
  • Creation of the FastMCP instance where order tools are registered.
    order_mcp = FastMCP(name="FinamOrderServer")
  • Core API client method that performs the actual order placement via Finam Trade API.
    async def place_order(self, order: Order, account_id: str) -> OrderState:
        """Выставление биржевой заявки"""
        order_body = {key: ({"value": str(value)} if isinstance(value, Decimal) else value) for key, value in
                      order.model_dump(exclude_unset=True).items()}
        response, ok = await self._exec_request(
            self.RequestMethod.POST,
            self._url.format(account_id=account_id),
            payload=order_body,
        )
    
        if not ok:
            err = ErrorModel(**response)
            raise FinamTradeApiError(f"code={err.code} | message={err.message} | details={err.details}")
    
        return OrderState(**response)

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