Orders
The Orders API allows you to create, cancel, and manage orders on the Xmarket platform.
Create Order
Create a new order in orderbook.
Authentication
All order operations require authentication using your API key in the x-api-key header:
Create Batch Order
Cancel Order
Cancel an existing open order.
Batch Create Orders
Create multiple orders in a single request for improved performance.
Cancel Order
Cancel an existing open order.
Cancel All Orders
Cancel all open orders for a specific market.
Batch Cancel Orders
Cancel multiple orders by their order IDs in a single request.
Get My Orders
Retrieve your orders with pagination and filtering options.
Get Market Orders
Retrieve all orders in a specific market, filtered by status and paginated.
Order Types
Limit Orders
Execute at a specific price or better
May not fill immediately
Provide liquidity to the market
Market Orders
Execute immediately at best available price
Guaranteed to fill (if liquidity exists)
Take liquidity from the market
Order Status
Orders can have the following statuses:
open
Order is active and waiting to be filled
partially_filled
Some quantity has been filled
filled
Order completely executed
cancelled
Order cancelled by user
expired
Order expired based on expiredAt time
Code Examples
Create a Limit Order
Batch Create Orders
Cancel Multiple Orders
Get Market Orders
Python Example - Create and Monitor Order
Best Practices
Order Validation: Always validate order parameters before submission
Batch Operations: Use batch endpoints when creating/cancelling multiple orders
Error Handling: Implement robust error handling for all API calls
Rate Limiting: Respect API rate limits to avoid being throttled
Order Management: Track your open orders and cancel outdated ones
Price Checks: Verify prices are within valid range (0 < price < 1)
Signature Security: Never expose your private key; sign orders securely
Idempotency: Consider implementing idempotency for order creation to prevent duplicates
Performance Optimization
Use batch create when placing multiple orders to reduce API calls
Use batch cancel to efficiently close multiple positions
Poll my-orders endpoint instead of individual order status checks
Cache market data to validate orders before submission
Related Documentation
Quick Start - Get started with the API
Markets API - Get market information before ordering
Orderbook API - Check current prices before placing orders
Positions API - Track your positions after orders fill
Last updated
Was this helpful?