create_order
Place cryptocurrency trading orders including limit, take profit, and stop loss orders to execute trading strategies on supported blockchain networks.
Instructions
Create a order. Can be a limit, take profit or stop loss order.
Expects a CreateOrderRequestContainer, returns a CreateOrderResponseContainer.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| create_order_requests | Yes |
Implementation Reference
- armor_crypto_mcp/armor_mcp.py:466-479 (handler)The primary MCP tool handler for 'create_order', registered via @mcp.tool(). It handles input validation via type hints, checks authentication, delegates to armor_client.create_order, and returns the response or error.@mcp.tool() async def create_order(create_order_requests: CreateOrderRequestContainer) -> CreateOrderResponseContainer: """ Create a order. Can be a limit, take profit or stop loss order. Expects a CreateOrderRequestContainer, returns a CreateOrderResponseContainer. """ if not armor_client: return [{"error": "Not logged in"}] try: result: CreateOrderResponseContainer = await armor_client.create_order(create_order_requests) return result except Exception as e: return [{"error": str(e)}]
- Helper method in ArmorWalletAPIClient that implements the core logic: serializes the request container to payload and makes a POST API call to the Armor Wallet API endpoint for creating orders.async def create_order(self, data: CreateOrderRequestContainer) -> CreateOrderResponseContainer: """Create a order.""" payload = data.model_dump(exclude_none=True)['create_order_requests'] return await self._api_call("POST", "transactions/order/create/", payload)
- Pydantic schema for a single CreateOrderRequest, defining fields like wallet, tokens, amount, duration, watch conditions for limit/take-profit/stop-loss orders.class CreateOrderRequest(BaseModel): wallet: str = Field(description="name of the wallet") input_token: str = Field(description="public address of the input token") output_token: str = Field(description="public address of the output token") amount: float = Field(description="amount of input token to invest") strategy_duration: int = Field(description="duration of the order") strategy_duration_unit: Literal["MINUTE", "HOUR", "DAY", "WEEK", "MONTH", "YEAR"] = Field(description="unit of the duration of the order") watch_field: Literal["liquidity", "marketCap", "price"] = Field(description="field to watch to execute the order. Can be price, marketCap or liquidity") direction: Literal["ABOVE", "BELOW"] = Field(description="whether or not the order is above or below current market value") token_address_watcher: str = Field(description="public address of the token to watch. should be output token for limit orders and input token for stop loss and take profit orders") target_value: Optional[float] = Field(description="target value to execute the order. You must always specify a target value or delta percentage.") delta_percentage: Optional[float] = Field(description="delta percentage to execute the order. You must always specify a target value or delta percentage.")
- Input container schema wrapping a list of CreateOrderRequest for batch processing in the MCP tool.class CreateOrderRequestContainer(BaseModel): create_order_requests: List[CreateOrderRequest]
- Output container schema wrapping a list of OrderResponse from the API.class CreateOrderResponseContainer(BaseModel): create_order_responses: List[OrderResponse]