REST
Authentication
All order-related endpoints require a valid signature. The signature is created by signing the order/cancel hash with the user's private key or an authorized delegate wallet.
Orders
Get Open Orders
Retrieves all open orders for a user.
Endpoint: GET /api/orders
Query Parameters:
user
string
Yes
User's Ethereum address
Example Request:
GET /api/orders?user=0x1234567890abcdef1234567890abcdef12345678Success Response (200):
{
"success": true,
"data": [
{
"hash": "0x...",
"user_address": "0x...",
"base_token": "0x...",
"asset": "btcusd",
"amount": "1000000000",
"price": "10000000000000",
"side": true,
"nonce": 1234567890,
"leverage": "1000000000",
"closing_order": false,
"remaining_amount": "1000000000",
"closed": false,
"stop": false,
"stop_price": "0",
"stopped": false,
"is_market": false,
"post_only": false,
"decimals": 2,
"amount_dec": 4,
"margin_currency_symbol": "USDC",
"created_at": "2024-01-15T10:30:00Z"
}
]
}Create Order
Creates a new trading order.
Endpoint: POST /api/order
Request Body:
Field Descriptions:
hash
string
Order hash (keccak256 of order parameters)
user_address
string
User's Ethereum address
base_token
string
Margin currency token address
asset
string
Trading pair symbol (e.g., "btcusd", "ethusd")
amount
string
Order amount (as string, scaled by 1e8)
price
string
Order price (as string, scaled by 1e8)
side
boolean
true = buy/long, false = sell/short
nonce
integer
Unique nonce for the order
leverage
string
Leverage amount (scaled by 1e8), 0 for cross margin
closing_order
boolean
true if this is a reduce-only order
v, r, s
-
ECDSA signature components
remaining_amount
string
Remaining unfilled amount
stop
boolean
true if this is a stop order
stop_price
string
Trigger price for stop orders
is_market
boolean
true for market orders
post_only
boolean
true to only add liquidity (maker only)
replace_hash
string
Hash of order to replace (for order amendments)
Success Response (200):
Error Response (400):
Possible Errors:
Nonce too largeInvalid order hash - please refresh and try againInvalid SignatureDelegate expiredOrder with this hash already existsMaximum 100 open orders allowedInsufficient balanceLeverage too highToo much leverageMinimum order value is 10 USDMaximum order value for this asset is X USDMin acceptable price is XMax acceptable price is X
Cancel Order
Cancels an existing open order.
Endpoint: POST /api/cancel-order
Request Body:
Field Descriptions:
order_hash
string
Hash of the order to cancel
v, r, s
-
ECDSA signature of the order hash
Success Response (200):
Error Response (400):
Possible Errors:
Order not foundLiquidation order cannot be canceledInvalid SignatureDelegate expired
Trades
Get User Trades
Retrieves trade history for a user (last 100 trades).
Endpoint: GET /api/trades
Query Parameters:
user
string
Yes
User's Ethereum address
Example Request:
Success Response (200):
Positions
Get Open Positions
Retrieves all open positions for a user.
Endpoint: GET /api/positions/open
Query Parameters:
user
string
Yes
User's Ethereum address
Example Request:
Success Response (200):
Get Closed Positions
Retrieves closed positions for a user (last 100).
Endpoint: GET /api/positions/closed
Query Parameters:
user
string
Yes
User's Ethereum address
Example Request:
Success Response (200):
Binary Contracts
Get Settled Binary Contracts
Retrieves historical settled binary contracts for a given underlying asset and contract duration.
Endpoint: GET /settled-binary-contracts
Query Parameters:
underlying
string
Yes
Underlying asset symbol (e.g., "BTCUSDT", "ETHUSDT")
contractLife
integer
Yes
Contract duration in minutes (e.g., 15, 60)
Example Request:
Success Response (200):
Response Field Descriptions:
symbol
string
Unique binary contract identifier
underlying_symbol
string
The underlying asset (e.g., "BTCUSD")
target
float
Strike/target price for the contract
final_price
float
Settlement price at contract expiry
is_above_target
boolean
true if final price was above target
started_at
integer
Contract start time (Unix timestamp)
settled_at
integer
Contract settlement time (Unix timestamp)
Error Responses:
400
Missing required parameter: underlying
400
Missing required parameter: contractLife
400
Invalid contractLife parameter
500
Failed to fetch settled contracts
Error Handling
All endpoints return errors in a consistent format:
HTTP Status Codes:
200
Success
400
Bad Request (validation error, business logic error)
405
Method Not Allowed
Notes
All
*big.Intvalues are represented as strings to preserve precisionAmounts and prices are scaled by
1e8unless otherwise specifiedTimestamps are in ISO 8601 format (UTC)
Ethereum addresses and hashes should include the
0xprefix
Last updated