paradex_cancel_orders
Cancel pending orders to manage market exposure, adjust strategies, or respond to changing conditions. Remove specific or all orders, clear stale trades, and reduce risk during market volatility.
Instructions
Cancel pending orders to manage exposure or adjust your trading strategy.
Use this tool when you need to:
- Remove stale limit orders that are no longer desirable
- Quickly reduce market exposure during volatility
- Update your order strategy by removing existing orders
- Clear your order book before implementing a new strategy
- React to changing market conditions by canceling pending orders
Order cancellation is a critical risk management function and allows you
to quickly adapt to changing market conditions.
Example use cases:
- Canceling limit orders when your outlook changes
- Removing all orders during unexpected market volatility
- Canceling a specific order identified by order ID
- Clearing all orders for a specific market
- Removing stale orders before placing new ones
Calling without any parameters will cancel all orders.
Succesful response indicates that orders were queued for cancellation.
Check order status using order id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | No | Client id (provided by you on create_order) | |
| market_id | No | Market is the market to cancel orders for | ALL |
| order_id | No | Order id (received from create_order) |
Implementation Reference
- src/mcp_paradex/tools/orders.py:138-186 (handler)The core handler function for the 'paradex_cancel_orders' tool. It authenticates with the Paradex client and cancels orders based on provided order_id, client_id, or market_id. Returns the OrderState of the canceled order. The function signature defines the input schema via Annotated Fields.@server.tool(name="paradex_cancel_orders") async def cancel_orders( order_id: Annotated[ str, Field(default="", description="Order id (received from create_order)") ], client_id: Annotated[ str, Field(default="", description="Client id (provided by you on create_order)") ], market_id: Annotated[ str, Field(default="ALL", description="Market is the market to cancel orders for") ], ctx: Context = None, ) -> OrderState: """ Cancel pending orders to manage exposure or adjust your trading strategy. Use this tool when you need to: - Remove stale limit orders that are no longer desirable - Quickly reduce market exposure during volatility - Update your order strategy by removing existing orders - Clear your order book before implementing a new strategy - React to changing market conditions by canceling pending orders Order cancellation is a critical risk management function and allows you to quickly adapt to changing market conditions. Example use cases: - Canceling limit orders when your outlook changes - Removing all orders during unexpected market volatility - Canceling a specific order identified by order ID - Clearing all orders for a specific market - Removing stale orders before placing new ones Calling without any parameters will cancel all orders. Succesful response indicates that orders were queued for cancellation. Check order status using order id. """ client = await get_authenticated_paradex_client() if order_id: response = client.cancel_order(order_id) elif client_id: response = client.cancel_order_by_client_id(client_id) elif market_id: response = client.cancel_all_orders(market_id) else: raise Exception("Either order_id or client_id must be provided.") order = OrderState(**response) return order