Skip to main content

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

ValueDescription
BUYBuy order (bid)
SELLSell order (ask)

Order Type

ValueDescription
LIMITLimit order at specified price
MARKETMarket order at best available price
TAKE_PROFIT_LIMITTake profit limit order - executes as limit order when price reaches profit target
TAKE_PROFIT_MARKETTake profit market order - executes as market order when price reaches profit target
STOP_LOSS_LIMITStop loss limit order - executes as limit order when price hits loss threshold
STOP_LOSS_MARKETStop loss market order - executes as market order when price hits loss threshold

Order Status

ValueDescription
NEWOrder is active and waiting to be filled
PARTIALLY_FILLEDOrder has been partially executed
FILLEDOrder has been completely filled
CANCELEDOrder has been canceled by user
REJECTEDOrder was rejected by the system
EXPIREDOrder has expired
PENDING_NEWOrder is pending placement
PENDING_CANCELOrder cancellation is pending

Contingency Type

ValueDescription
NONENo contingency (regular order)
OCOOne Cancels Other - when one order fills, the other is automatically canceled
OTOOne Triggers Other - when primary order fills, secondary order is automatically placed

OTO Leg Type

ValueDescription
NONENot part of an OTO order
WORKING_LEGThe primary order that must fill first
TP_LEGTake Profit leg - triggered when price reaches profit target
SL_LEGStop Loss leg - triggered when price hits loss limit
OCO_LEGPart of an OCO (One Cancels Other) pair

Order Mode

ValueDescriptionFilled Field
0Base token quantity mode - order quantity specified in base tokenorigQty
1Quote 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:

NameTypeMandatoryDescription
addressSTRINGYESWallet address (0x...)
marketIdSTRINGNOMarket identifier (e.g., "1_2"). If not provided, returns open orders for all markets
fromLONGNOStart timestamp in milliseconds. Default: 0
toLONGNOEnd timestamp in milliseconds. Default: current time
limitINTNOMaximum 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:

FieldTypeDescription
idINTEGEROrder database ID
orderIdSTRINGUnique order identifier (transaction hash format)
accountAddressSTRINGWallet address of order creator
marketIdSTRINGMarket identifier (baseTokenId_quoteTokenId)
sideENUMOrder side - see Order Side enum values
orderTypeENUMOrder type - see Order Type enum values
orderModeINTEGEROrder mode: 0 = base token quantity mode (uses origQty), 1 = quote token quantity mode (uses origQuoteOrderQty, market orders only)
priceSTRINGLimit price in quote token (0 for market orders)
origQtySTRINGOriginal order quantity in base token (filled when orderMode=0)
origQuoteOrderQtySTRINGOriginal order quantity in quote token (filled when orderMode=1)
isTriggerBOOLEANWhether this is a trigger order (stop-loss or take-profit)
isTriggeredBOOLEANWhether a trigger order has been activated
triggerPriceSTRINGPrice at which trigger order activates (0 for non-trigger orders)
statusENUMCurrent order status - see Order Status enum values
contingencyTypeENUMOrder contingency - see Contingency Type enum values
otoLegTypeENUMOTO order leg type - see OTO Leg Type enum values
txHashSTRINGTransaction hash on blockchain
createdAtLONGOrder creation timestamp in milliseconds (Unix epoch)
updatedAtLONGLast update timestamp in milliseconds (Unix epoch)
executedQtySTRINGTotal executed quantity in base token
executedQuoteQtySTRINGTotal executed value in quote token

Query Completed Order History

GET /api/v1/order

Get historical orders (filled, canceled, rejected) for a wallet address.

Parameters:

NameTypeMandatoryDescription
addressSTRINGYESWallet address (0x...)
marketIdSTRINGNOFilter by market ID
fromLONGNOStart timestamp in milliseconds. Default: 0
toLONGNOEnd timestamp in milliseconds. Default: current time
limitINTNOMaximum 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:

NameTypeMandatoryDescription
orderIdSTRINGYESOrder 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:

Query Trade History

GET /api/v1/order/trade

Get executed trades for a wallet address.

Parameters:

NameTypeMandatoryDescription
addressSTRINGYESWallet address (0x...)
marketIdSTRINGNOFilter by market ID
fromLONGNOStart timestamp in milliseconds. Default: 0
toLONGNOEnd timestamp in milliseconds. Default: current time
limitINTNOMaximum 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:

FieldTypeDescription
idINTEGERTrade database ID
tradeIdSTRINGUnique trade identifier
orderIdSTRINGOrder that generated this trade
accountAddressSTRINGWallet address of the trader
marketIdSTRINGMarket identifier (baseTokenId_quoteTokenId)
sideSTRINGTrade side ("BUY" or "SELL")
orderTypeSTRINGOrder type (e.g., "LIMIT", "MARKET")
origPriceSTRINGOriginal order price
origQtySTRINGOriginal order quantity
priceSTRINGExecution price in quote token
quantitySTRINGExecuted quantity in base token
feeSTRINGTrading fee paid for this execution
feeTokenIdSTRINGToken ID in which fee was paid
isMakerBOOLEANTrue if this was a maker trade (provided liquidity), false if taker
createdAtLONGTrade 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)