Skip to main content
Glama
Habinar

MCP Paradex Server

by Habinar

paradex_cancel_orders

Cancel pending orders to manage trading exposure, adjust strategies, or respond to market changes. Remove specific orders or clear all orders when needed.

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
NameRequiredDescriptionDefault
order_idNoOrder id (received from create_order)
client_idNoClient id (provided by you on create_order)
market_idNoMarket is the market to cancel orders forALL

Implementation Reference

  • The handler function decorated with @server.tool(name="paradex_cancel_orders"). This implements the core logic: authenticates a Paradex client and calls cancel_order, cancel_order_by_client_id, or cancel_all_orders based on provided parameters, returning the OrderState.
    @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
  • Pydantic Field annotations defining the input schema for the paradex_cancel_orders tool, including order_id, client_id, and market_id parameters.
    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:
  • The @server.tool decorator registers the cancel_orders function as the MCP tool named 'paradex_cancel_orders'.
    @server.tool(name="paradex_cancel_orders")
  • Uses the helper get_authenticated_paradex_client() to obtain the Paradex client for cancellation operations.
    client = await get_authenticated_paradex_client()

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/Habinar/mcp-paradex-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server