Trading Endpoints
API endpoints for executing trades.
Execute Trade
POST /api/trade
Content-Type: application/json
Cookie: session=<token>
{
"symbol": "BTC",
"side": "buy",
"size": 0.1,
"price": 50000,
"tif": "GTC",
"reduceOnly": false,
"vaultAddress": "0x..."
}Parameters:
Field
Type
Required
Description
symbol
string
Yes
Asset symbol (BTC, ETH, etc.)
side
string
Yes
"buy" or "sell"
size
number
Yes
Order size
price
number
No
Limit price (omit for market)
tif
string
No
Time in force: GTC, IOC, ALO
reduceOnly
boolean
No
Only reduce position
vaultAddress
string
No
Trade with vault capital
Response:
{
"ok": true,
"data": {
"orderId": 12345,
"status": "submitted",
"timestamp": 1698765432000
}
}Errors:
Code
Meaning
VAULT_PAUSED
Vault auto-paused by risk limits
INSUFFICIENT_BALANCE
Not enough margin
INVALID_INPUT
Invalid parameters
BALANCE_STALE
Vault balance too old
Get Open Orders
GET /api/orders
Cookie: session=<token>Response:
{
"ok": true,
"data": {
"orders": [
{
"orderId": 123,
"symbol": "BTC",
"side": "buy",
"size": 0.1,
"price": 50000,
"status": "resting"
}
]
}
}Cancel Order
DELETE /api/orders/:orderId
Cookie: session=<token>Response:
{
"ok": true,
"data": {
"orderId": 123,
"status": "canceled"
}
}Get Positions
GET /api/positions
Cookie: session=<token>Response:
{
"ok": true,
"data": {
"positions": [
{
"symbol": "BTC",
"size": 0.5,
"entryPrice": 49500,
"markPrice": 50000,
"unrealizedPnl": 250,
"liquidationPrice": 42000
}
]
}
}Close Position
POST /api/positions/close
Content-Type: application/json
Cookie: session=<token>
{
"symbol": "BTC",
"size": 0.5
}Related Pages
Last updated