create_order
Create limit, take profit, or stop loss orders on the Armor Crypto MCP server. Define wallet, input/output tokens, amount, duration, and watch fields like price or liquidity to execute trades based on market conditions.
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-480 (handler)MCP tool handler function for 'create_order'. Decorated with @mcp.tool() for automatic registration. Validates input, calls armor_client.create_order, handles errors, and returns CreateOrderResponseContainer.@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)}]
- Core implementation in ArmorWalletAPIClient that performs the HTTP POST to the Armor API endpoint for creating orders. Prepares payload from CreateOrderRequestContainer and calls _api_call.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 model defining the structure for a single CreateOrderRequest, used within CreateOrderRequestContainer for input validation.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.")
- Container Pydantic models for batch input (CreateOrderRequestContainer) and output (CreateOrderResponseContainer) of the create_order tool.class CreateOrderRequestContainer(BaseModel): create_order_requests: List[CreateOrderRequest] class CreateOrderResponseContainer(BaseModel): create_order_responses: List[OrderResponse]
- armor_crypto_mcp/armor_mcp.py:466-480 (registration)The @mcp.tool() decorator registers this function as an MCP tool named 'create_order' in the FastMCP server.@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)}]