Orders
General Information
- All endpoints return data in JSON format
- All timestamps are in milliseconds (Unix epoch time)
- Order endpoints use address-based authentication (no JWT required)
- Order placement, modification, and cancellation require signed transactions
Enum Values
Order Side
| Value | Description |
|---|---|
| BUY | Buy order (bid) |
| SELL | Sell order (ask) |
Order Type
| Value | Description |
|---|---|
| LIMIT | Limit order at specified price |
| MARKET | Market order at best available price |
| TAKE_PROFIT_LIMIT | Take profit limit order - executes as limit order when price reaches profit target |
| TAKE_PROFIT_MARKET | Take profit market order - executes as market order when price reaches profit target |
| STOP_LOSS_LIMIT | Stop loss limit order - executes as limit order when price hits loss threshold |
| STOP_LOSS_MARKET | Stop loss market order - executes as market order when price hits loss threshold |
Order Status
| Value | Description |
|---|---|
| NEW | Order is active and waiting to be filled |
| PARTIALLY_FILLED | Order has been partially executed |
| FILLED | Order has been completely filled |
| CANCELED | Order has been canceled by user |
| REJECTED | Order was rejected by the system |
| EXPIRED | Order has expired |
| PENDING_NEW | Order is pending placement |
| PENDING_CANCEL | Order cancellation is pending |
Contingency Type
| Value | Description |
|---|---|
| NONE | No contingency (regular order) |
| OCO | One Cancels Other - when one order fills, the other is automatically canceled |
| OTO | One Triggers Other - when primary order fills, secondary order is automatically placed |
OTO Leg Type
| Value | Description |
|---|---|
| NONE | Not part of an OTO order |
| WORKING_LEG | The primary order that must fill first |
| TP_LEG | Take Profit leg - triggered when price reaches profit target |
| SL_LEG | Stop Loss leg - triggered when price hits loss limit |
| OCO_LEG | Part of an OCO (One Cancels Other) pair |
Order Mode
| Value | Description | Filled Field |
|---|---|---|
| 0 | Base token quantity mode - order quantity specified in base token | origQty |
| 1 | Quote token quantity mode - order quantity specified in quote token (market orders only) | origQuoteOrderQty |
Note: When orderMode=0, the order quantity is specified in the base token (e.g., BTC in BTC/USDT), and the origQty field will be filled while origQuoteOrderQty will be "0". When orderMode=1, the order quantity is specified in the quote token (e.g., USDT in BTC/USDT), and the origQuoteOrderQty field will be filled while origQty will be "0".
Important: Quote mode (orderMode=1) can only be used for market orders that execute at the best available price. It cannot be used for limit orders. This is particularly useful for market buy orders where you want to specify the amount in quote token (e.g., "buy with 1000 USDT").
Query Open Orders
GET /api/v1/order/open
Get all open orders (NEW or PARTIALLY_FILLED status) for a wallet address.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| address | STRING | YES | Wallet address (0x...) |
| marketId | STRING | NO | Market identifier (e.g., "1_2"). If not provided, returns open orders for all markets |
| from | LONG | NO | Start timestamp in milliseconds. Default: 0 |
| to | LONG | NO | End timestamp in milliseconds. Default: current time |
| limit | INT | NO | Maximum number of results. Default: 100, Min: 1 |
Time Range Constraints:
- Maximum time range: 90 days
- Default time range: 30 days (when both from and to are 0 or not provided)
- Historical data limit: Up to 730 days (2 years) in the past
- Future timestamps are not allowed
Response:
{
"code": 200,
"errMsg": "OK",
"result": [
{
"id": 1011335,
"orderId": "0x57edb3d6e2eff8e6cdf45ee171609975a5ad0318a8c8d896dcd93eef18584b52",
"accountAddress": "0x1234567890123456789012345678901234567890",
"marketId": "1_2",
"side": "BUY",
"orderType": "LIMIT",
"orderMode": 0,
"price": "2.3",
"origQty": "10.5",
"origQuoteOrderQty": "0",
"isTrigger": false,
"isTriggered": false,
"triggerPrice": "0",
"status": "PARTIALLY_FILLED",
"contingencyType": "NONE",
"otoLegType": "NONE",
"txHash": "0x57edb3d6e2eff8e6cdf45ee171609975a5ad0318a8c8d896dcd93eef18584b52",
"createdAt": 1758005316000,
"updatedAt": 1758005416000,
"executedQty": "5.2",
"executedQuoteQty": "11.96"
}
]
}
Response Fields:
| Field | Type | Description |
|---|---|---|
| id | INTEGER | Order database ID |
| orderId | STRING | Unique order identifier (transaction hash format) |
| accountAddress | STRING | Wallet address of order creator |
| marketId | STRING | Market identifier (baseTokenId_quoteTokenId) |
| side | ENUM | Order side - see Order Side enum values |
| orderType | ENUM | Order type - see Order Type enum values |
| orderMode | INTEGER | Order mode: 0 = base token quantity mode (uses origQty), 1 = quote token quantity mode (uses origQuoteOrderQty, market orders only) |
| price | STRING | Limit price in quote token (0 for market orders) |
| origQty | STRING | Original order quantity in base token (filled when orderMode=0) |
| origQuoteOrderQty | STRING | Original order quantity in quote token (filled when orderMode=1) |
| isTrigger | BOOLEAN | Whether this is a trigger order (stop-loss or take-profit) |
| isTriggered | BOOLEAN | Whether a trigger order has been activated |
| triggerPrice | STRING | Price at which trigger order activates (0 for non-trigger orders) |
| status | ENUM | Current order status - see Order Status enum values |
| contingencyType | ENUM | Order contingency - see Contingency Type enum values |
| otoLegType | ENUM | OTO order leg type - see OTO Leg Type enum values |
| txHash | STRING | Transaction hash on blockchain |
| createdAt | LONG | Order creation timestamp in milliseconds (Unix epoch) |
| updatedAt | LONG | Last update timestamp in milliseconds (Unix epoch) |
| executedQty | STRING | Total executed quantity in base token |
| executedQuoteQty | STRING | Total executed value in quote token |
Query Completed Order History
GET /api/v1/order
Get historical orders (filled, canceled, rejected) for a wallet address.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| address | STRING | YES | Wallet address (0x...) |
| marketId | STRING | NO | Filter by market ID |
| from | LONG | NO | Start timestamp in milliseconds. Default: 0 |
| to | LONG | NO | End timestamp in milliseconds. Default: current time |
| limit | INT | NO | Maximum number of results. Default: 100, Min: 1, Max: 500 |
Time Range Constraints:
- Maximum time range: 90 days
- Default time range: 30 days (when both from and to are 0 or not provided)
- Historical data limit: Up to 730 days (2 years) in the past
- Future timestamps are not allowed
Response:
{
"code": 200,
"errMsg": "OK",
"result": [
{
"orderId": "0x4bed76ae0c75b1d1d0b291873ad7fb58b0986955ae0d49ca642a0f8c48efbae5",
"accountAddress": "0x1234567890123456789012345678901234567890",
"marketId": "1_2",
"side": "SELL",
"orderType": "LIMIT",
"price": "2.5",
"origQty": "8.0",
"origQuoteOrderQty": "20.0",
"status": "FILLED",
"txHash": "0x4bed76ae0c75b1d1d0b291873ad7fb58b0986955ae0d49ca642a0f8c48efbae5",
"createdAt": 1758004316000,
"updatedAt": 1758005316000,
"executedQty": "8.0",
"executedQuoteQty": "20.0"
}
]
}
Query Order by ID
GET /api/v1/order/{orderId}
Get details of a specific order by order ID.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| orderId | STRING | YES | Order ID (in path) |
Response:
{
"code": 200,
"errMsg": "OK",
"result": {
"orderId": "0x4bed76ae0c75b1d1d0b291873ad7fb58b0986955ae0d49ca642a0f8c48efbae3",
"accountAddress": "0x1234567890123456789012345678901234567890",
"marketId": "1_2",
"side": "BUY",
"orderType": "LIMIT",
"price": "2.3",
"origQty": "10.5",
"origQuoteOrderQty": "24.15",
"status": "NEW",
"txHash": "0x4bed76ae0c75b1d1d0b291873ad7fb58b0986955ae0d49ca642a0f8c48efbae3",
"createdAt": 1758005316000,
"updatedAt": 1758005316000,
"executedQty": "0",
"executedQuoteQty": "0"
}
}
Response Fields:
Same as Query Open Orders response fields, but returns a single order object instead of an array.
POST Endpoints for Orders
All order POST operations (place, cancel, modify) require signed transactions sent to the fixed contract address.
For detailed transaction structure and examples, see Transaction Structure Documentation:
- Place Order: Section 2
- Place TPSL Order: Section 2-1
- Cancel Order: Section 3
- Cancel All Orders: Section 4
- Modify Order: Section 5
- Stop Order: Section 6
Query Trade History
GET /api/v1/order/trade
Get executed trades for a wallet address.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| address | STRING | YES | Wallet address (0x...) |
| marketId | STRING | NO | Filter by market ID |
| from | LONG | NO | Start timestamp in milliseconds. Default: 0 |
| to | LONG | NO | End timestamp in milliseconds. Default: current time |
| limit | INT | NO | Maximum number of results. Default: 100, Min: 1, Max: 500 |
Time Range Constraints:
- Maximum time range: 90 days
- Default time range: 30 days (when both from and to are 0 or not provided)
- Historical data limit: Up to 730 days (2 years) in the past
- Future timestamps are not allowed
Response:
{
"code": 200,
"errMsg": "OK",
"result": [
{
"id": 971249,
"orderId": "0x20c859e2a894d76d1e022e24b608b59c567e74c89baa3c71abe2c05e65f3b0aa",
"accountAddress": "0x1234567890123456789012345678901234567890",
"marketId": "3_2",
"side": "BUY",
"orderType": "LIMIT",
"origPrice": "7",
"origQty": "2",
"price": "7",
"quantity": "1",
"feeTokenId": "3",
"fee": "0.0001",
"isMaker": true,
"tradeId": "23040400030001",
"createdAt": 1758684608000
}
]
}
Response Fields:
| Field | Type | Description |
|---|---|---|
| id | INTEGER | Trade database ID |
| tradeId | STRING | Unique trade identifier |
| orderId | STRING | Order that generated this trade |
| accountAddress | STRING | Wallet address of the trader |
| marketId | STRING | Market identifier (baseTokenId_quoteTokenId) |
| side | STRING | Trade side ("BUY" or "SELL") |
| orderType | STRING | Order type (e.g., "LIMIT", "MARKET") |
| origPrice | STRING | Original order price |
| origQty | STRING | Original order quantity |
| price | STRING | Execution price in quote token |
| quantity | STRING | Executed quantity in base token |
| fee | STRING | Trading fee paid for this execution |
| feeTokenId | STRING | Token ID in which fee was paid |
| isMaker | BOOLEAN | True if this was a maker trade (provided liquidity), false if taker |
| createdAt | LONG | Trade execution timestamp in milliseconds (Unix epoch) |
Notes
- Order IDs are unique across the system
- Market orders cannot have a limit price
- Trigger orders activate when market price crosses the trigger price
- OCO (One Cancels Other) orders automatically cancel the paired order when one fills
- OTO (One Triggers Other) orders automatically place a secondary order when the primary fills
- All prices and quantities are strings to preserve precision
- Results are sorted by ID in descending order (newest first)