Skip to main content
Glama
sv

MCP Paradex Server

by sv

paradex_create_order

Execute trades on Paradex with precise control over order parameters, including limit, stop-loss, take-profit, and conditional orders for risk management and strategy implementation.

Instructions

Execute trades on Paradex with precise control over all order parameters. Use this tool when you need to: - Enter a new position based on your trading strategy - Set limit orders at specific price levels - Create stop-loss or take-profit orders for risk management - Implement complex trading strategies with conditional orders This is the primary tool for executing your trading decisions on Paradex, with full control over order type, size, price, and execution parameters. Example use cases: - Setting limit orders at key support/resistance levels - Placing stop-limit orders to manage risk on existing positions - Executing market orders for immediate entry or exit - Creating reduce-only orders to ensure you don't flip position direction Succesful response indicates that orders were queued for execution. Check order status using order id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
market_idYesMarket identifier.
order_sideYesOrder side.
order_typeYesOrder type.
sizeYesOrder size.
priceYesOrder price (required for LIMIT orders).
trigger_priceYesTrigger price for stop limit orders.
instructionNoInstruction for order execution.GTC
reduce_onlyNoReduce-only flag.
client_idYesClient-specified order ID.

Implementation Reference

  • The primary handler function for the 'paradex_create_order' tool. It constructs an Order object from parameters, submits it using the Paradex client, and returns the resulting OrderState.
    @server.tool(name="paradex_create_order") async def create_order( market_id: Annotated[str, Field(description="Market identifier.")], order_side: Annotated[OrderSideEnum, Field(description="Order side.")], order_type: Annotated[OrderTypeEnum, Field(description="Order type.")], size: Annotated[float, Field(description="Order size.")], price: Annotated[float, Field(description="Order price (required for LIMIT orders).")], trigger_price: Annotated[float, Field(description="Trigger price for stop limit orders.")], instruction: Annotated[ InstructionEnum, Field(default="GTC", description="Instruction for order execution.") ], reduce_only: Annotated[bool, Field(default=False, description="Reduce-only flag.")], client_id: Annotated[str, Field(description="Client-specified order ID.")], ctx: Context = None, ) -> dict: """ Execute trades on Paradex with precise control over all order parameters. Use this tool when you need to: - Enter a new position based on your trading strategy - Set limit orders at specific price levels - Create stop-loss or take-profit orders for risk management - Implement complex trading strategies with conditional orders This is the primary tool for executing your trading decisions on Paradex, with full control over order type, size, price, and execution parameters. Example use cases: - Setting limit orders at key support/resistance levels - Placing stop-limit orders to manage risk on existing positions - Executing market orders for immediate entry or exit - Creating reduce-only orders to ensure you don't flip position direction Succesful response indicates that orders were queued for execution. Check order status using order id. """ client = await get_authenticated_paradex_client() o = Order( market=market_id, order_side=OrderSide(order_side), order_type=OrderType(order_type), size=Decimal(str(size)), client_id=client_id, limit_price=Decimal(str(price)) if price else Decimal(0), reduce_only=reduce_only, instruction=instruction, trigger_price=Decimal(str(trigger_price)) if trigger_price else None, ) response = client.submit_order(o) order: OrderState = OrderState(**response) result = { "description": OrderState.__doc__.strip() if OrderState.__doc__ else None, "fields": OrderState.model_json_schema(), "results": order, } return result
  • Enum types (OrderTypeEnum, InstructionEnum, OrderSideEnum) used for input parameter validation in the paradex_create_order handler.
    # Define allowed order types OrderTypeEnum = Literal[ "MARKET", "LIMIT", "STOP_LIMIT", "STOP_MARKET", "TAKE_PROFIT_LIMIT", "TAKE_PROFIT_MARKET", "STOP_LOSS_MARKET", "STOP_LOSS_LIMIT", ] # Define allowed instruction types InstructionEnum = Literal["GTC", "IOC", "POST_ONLY"] OrderSideEnum = Literal["BUY", "SELL"]
  • Pydantic model OrderState used for parsing and serializing the order response in the tool's output.
    class OrderState(BaseModel): """Order state model representing the current state of an order on Paradex.""" id: Annotated[str, Field(description="Unique order identifier generated by Paradex")] account: Annotated[str, Field(description="Paradex Account")] market: Annotated[str, Field(description="Market")] side: Annotated[str, Field(description="Order side")] type: Annotated[str, Field(description="Order type")] size: Annotated[float, Field(description="Order size")] remaining_size: Annotated[float, Field(description="Remaining size of the order")] price: Annotated[float, Field(description="Order price. 0 for MARKET orders")] status: Annotated[str, Field(description="Order status")] created_at: Annotated[int, Field(description="Order creation time")] last_updated_at: Annotated[ int, Field(description="Order last update time. No changes once status=CLOSED") ] timestamp: Annotated[int, Field(description="Order signature timestamp")] cancel_reason: Annotated[ str, Field(description="Reason for order cancellation if it was closed by cancel") ] client_id: Annotated[ str, Field(description="Client order id provided by the client at order creation") ] seq_no: Annotated[ int, Field( description="Unique increasing number that is assigned to this order update and changes on every order update" ), ] instruction: Annotated[str, Field(description="Execution instruction for order matching")] avg_fill_price: Annotated[str, Field(description="Average fill price of the order")] stp: Annotated[str, Field(description="Self Trade Prevention mode")] received_at: Annotated[ int, Field(description="Timestamp in milliseconds when order was received by API service") ] published_at: Annotated[ int, Field(description="Timestamp in milliseconds when order was sent to the client") ] flags: Annotated[list[str], Field(description="Order flags, allow flag: REDUCE_ONLY")] trigger_price: Annotated[str, Field(description="Trigger price for stop order")]
  • Helper function that provides the authenticated ParadexApiClient instance used by the handler to submit orders.
    async def get_authenticated_paradex_client() -> ParadexApiClient: """ Get or initialize the authenticated Paradex client. Returns: Paradex: The initialized Paradex client. Raises: ValueError: If the required configuration is not set. """ client = await get_paradex_client() if client.account is None: raise ValueError("Paradex client is not authenticated") return client
  • The @server.tool decorator registers the create_order function as the MCP tool named 'paradex_create_order'.
    @server.tool(name="paradex_create_order")

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

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