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
| Name | Required | Description | Default |
|---|---|---|---|
| order | Yes |
Implementation Reference
- src/servers/order.py:23-26 (handler)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)
- src/tradeapi/order/models.py:94-108 (schema)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")
- src/servers/order.py:8-8 (registration)Creation of the FastMCP instance where order tools are registered.order_mcp = FastMCP(name="FinamOrderServer")
- src/tradeapi/order/orders.py:40-54 (helper)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)