Place Trading Orders
Execute trading orders on supported exchanges. Each exchange has its own endpoint with specific requirements.
Supported Exchanges
| Exchange | Endpoint | Symbol Format | Notes |
|---|
| Aster | POST /api/trading/aster/orders | BTCUSDT | Requires x-wallet-id header |
| Hyperliquid | POST /api/trading/hyperliquid/orders | BTC | Requires x-wallet-id header |
| Lighter | POST /api/trading/lighter/orders | USDC | Requires API credentials as query params |
Lighter DEX Requirement: Before using Lighter, you must:
- Create an account on Lighter DEX
- Deposit funds on Lighter
- Generate API keys from Lighter dashboard
- Provide credentials as query parameters
Aster - Place Order
Execute orders on Aster exchange for perpetual futures trading.
Endpoint
POST /api/aster/perp/:walletId/order
Path Parameters
| Parameter | Type | Required | Description |
|---|
walletId | string | Yes | Wallet ID (UUID) |
Request Body
{
"symbol": "BTCUSDT",
"side": "BUY",
"type": "MARKET",
"quantity": "0.001",
"positionSide": "BOTH"
}
Request Parameters
| Field | Type | Required | Description |
|---|
symbol | string | Yes | Trading pair (e.g., “BTCUSDT”) |
side | string | Yes | ”BUY” (open LONG/close SHORT) or “SELL” (open SHORT/close LONG) |
type | string | Yes | Order type: “MARKET”, “LIMIT”, “STOP_MARKET”, “TAKE_PROFIT_MARKET” |
quantity | string | Yes | Base asset quantity |
price | string | No | Required for LIMIT orders |
positionSide | string | No | ”BOTH” (one-way mode, default), “LONG”, or “SHORT” (hedge mode) |
reduceOnly | boolean | No | Prevent increasing exposure |
timeInForce | string | No | ”GTC” (default), “IOC”, or “FOK” |
Order Types
MARKET - Execute immediately at best price
LIMIT - Execute only at specified price
STOP_MARKET - Stop loss (market execution)
TAKE_PROFIT_MARKET - Take profit (market execution)
Position Sides
BOTH - One-way mode (default) - single position per symbol
LONG - Long position (hedge mode)
SHORT - Short position (hedge mode)
Time in Force
GTC - Good Till Cancel (default)
IOC - Immediate or Cancel
FOK - Fill or Kill
Example Request
curl -X POST https://api.dexaggregatorbeta.xyz/api/aster/perp/ee337309-3e77-4278-b21a-4681468168ba/order \
-H "Content-Type: application/json" \
-d '{
"symbol": "BTCUSDT",
"side": "BUY",
"type": "MARKET",
"quantity": "0.001",
"positionSide": "BOTH"
}'
Success Response
{
"success": true,
"data": {
"orderId": 9884649221,
"symbol": "BTCUSDT",
"status": "NEW",
"clientOrderId": "6D52PQwRlg0PcdHz5ttkgN",
"price": "0",
"avgPrice": "0.0000",
"origQty": "0.001",
"executedQty": "0",
"cumQty": "0",
"cumQuote": "0",
"timeInForce": "GTC",
"type": "MARKET",
"reduceOnly": false,
"closePosition": false,
"side": "BUY",
"positionSide": "BOTH",
"stopPrice": "0",
"workingType": "CONTRACT_PRICE",
"priceProtect": false,
"origType": "MARKET",
"updateTime": 1764640797006
}
}
Hyperliquid - Place Order
Execute orders on Hyperliquid exchange for perpetual futures trading.
Endpoint
POST /api/trading/hyperliquid/orders
| Header | Value | Required |
|---|
x-wallet-id | Wallet ID (UUID) | Yes |
Content-Type | application/json | Yes |
Request Body
{
"userId": "a1e82339-29f8-41a6-a468-ce8d268a3261",
"symbol": "BTC",
"side": "SELL",
"type": "MARKET",
"quantity": "0.01",
"price": "87131.0",
"reduceOnly": false
}
Request Parameters
| Field | Type | Required | Description |
|---|
userId | string | Yes | User’s wallet ID or address |
symbol | string | Yes | Asset symbol (e.g., “BTC”, “ETH”, “HYPE”) |
side | string | Yes | ”BUY” or “SELL” |
type | string | Yes | ”MARKET” or “LIMIT” |
quantity | string | Yes | Base asset quantity |
price | string | Yes | Price for the order |
reduceOnly | boolean | No | Prevent increasing exposure (default: false) |
Hyperliquid uses simple asset symbols like BTC, ETH, HYPE. The price field should be provided for both MARKET and LIMIT orders.
Example Request
curl -X POST https://api.dexaggregatorbeta.xyz/api/trading/hyperliquid/orders \
-H "x-wallet-id: a1e82339-29f8-41a6-a468-ce8d268a3261" \
-H "Content-Type: application/json" \
-d '{
"userId": "a1e82339-29f8-41a6-a468-ce8d268a3261",
"symbol": "BTC",
"side": "SELL",
"type": "MARKET",
"quantity": "0.01",
"price": "87131.0",
"reduceOnly": false
}'
Success Response
{
"success": true,
"data": {
"orderId": "255730787458",
"status": "FILLED",
"symbol": "BTC",
"side": "SELL",
"type": "MARKET",
"price": "87131.0",
"quantity": "0.01",
"filledQuantity": "0.00157",
"timestamp": 1764688069312
},
"timestamp": 1764688069314
}
Lighter - Place Order
Execute orders on Lighter DEX using API credentials from your Lighter account.
Endpoint
POST /api/trading/lighter/orders
Query Parameters (Required)
These credentials must be obtained from your Lighter DEX account dashboard.
| Parameter | Type | Required | Description |
|---|
apiKeyPrivateKey | string | Yes | Your Lighter API key private key (hex format) |
apiKeyIndex | number | Yes | API key index from Lighter |
accountIndex | number | Yes | Your Lighter account index |
Full Example URL
POST /api/trading/lighter/orders?apiKeyPrivateKey=539ef81cacb...&apiKeyIndex=5&accountIndex=316225
Request Body
{
"userId": "0x07943f0f79097572451601e768c329a2765f2ea2",
"symbol": "USDC",
"side": "BUY",
"type": "MARKET",
"quantity": "1.1",
"price": "1",
"reduceOnly": true
}
Request Parameters
| Field | Type | Required | Description |
|---|
userId | string | Yes | User’s wallet address |
symbol | string | Yes | Token symbol (e.g., “USDC”) |
side | string | Yes | ”BUY” or “SELL” |
type | string | Yes | ”MARKET” or “LIMIT” |
quantity | string | Yes | Base asset quantity |
price | string | No | Required for LIMIT orders |
reduceOnly | boolean | No | Prevent increasing exposure |
Lighter uses spot token symbols like “USDC”. Quantity is in base asset units.
Example Request
curl -X POST "https://api.dexaggregatorbeta.xyz/api/trading/lighter/orders?apiKeyPrivateKey=539ef81cacb...&apiKeyIndex=5&accountIndex=316225" \
-H "Content-Type: application/json" \
-d '{
"userId": "0x07943f0f79097572451601e768c329a2765f2ea2",
"symbol": "USDC",
"side": "BUY",
"type": "MARKET",
"quantity": "1.1",
"price": "1",
"reduceOnly": true
}'
Success Response
{
"success": true,
"orderId": "948233341",
"status": "submitted",
"adapter": "lighter",
"timestamp": 1698840000000
}
Error Responses
400 Bad Request - Missing Parameters
{
"success": false,
"error": "Missing required parameters",
"timestamp": 1698840000000
}
400 Bad Request - Invalid Order Type
{
"success": false,
"error": "Invalid order type. Must be MARKET or LIMIT",
"timestamp": 1698840000000
}
401 Unauthorized - Missing Wallet ID
{
"success": false,
"error": "Missing x-wallet-id header",
"timestamp": 1698840000000
}
403 Forbidden - Invalid API Credentials (Lighter)
{
"success": false,
"error": "Invalid API credentials",
"timestamp": 1698840000000
}
500 Internal Server Error
{
"success": false,
"error": "Failed to place order",
"timestamp": 1698840000000
}
Order Types
Market Orders
Execute immediately at the best available price.
{
"type": "MARKET",
"quantity": "0.1"
}
Limit Orders
Execute only at the specified price or better.
{
"type": "LIMIT",
"quantity": "0.1",
"price": "50000"
}
Important Notes
Lighter API Credentials: Never expose your Lighter API credentials in client-side code. Always make requests from your secure backend server.
Wallet ID Header: For Aster and Hyperliquid, you must include the x-wallet-id header with your server wallet ID.
Reduce Only: Set reduceOnly: true to ensure orders only close existing positions and don’t open new ones.
Symbol Formats:
- Aster:
BTCUSDT, ETHUSDT
- Hyperliquid:
BTC, ETH, HYPE (simple asset symbols)
- Lighter:
USDC, USDT