REST API — Orders
The HTTP shapes behind the order surface. The TypeScript SDK maps 1:1 onto these operations and signs venue actions locally — it does not call a base URL.
What this reference is. openapi.yaml (shipped with @tria-sdk/api-trading)
is the single source of truth for request/response shapes. Direction A
(the SDK) signs HL L1 actions and Aptos txs locally with your keys and never
hits an HTTP base URL — use the SDK for live trading today. Direction
B (the future hosted gateway) will serve these exact paths over HTTP with
HMAC auth headers (X-Tria-Key, X-Tria-Timestamp, X-Tria-Signature). The
shapes are identical across both.
All size, price, fee, and PnL amounts are decimal strings, never JSON numbers — parse with a decimal library (dnum, decimal.js). POST /v1/orders is idempotent on (user, venue, clientOrderId).
Place an order
Submit a single order. Re-using a live clientOrderId returns the original response (idempotent), so a retry can't double the order.
Request body
- Name
venue- Type
- string
- Description
hlordecibel.
- Name
market- Type
- string
- Description
BTC(HL) orBTC/USD(Decibel).
- Name
side- Type
- string
- Description
buyorsell.
- Name
size- Type
- string
- Description
- Positive decimal string.
- Name
price- Type
- string
- Description
- Limit price. Omit for IOC market-style.
- Name
tif- Type
- string
- Description
gtc|ioc|alo.
- Name
reduceOnly- Type
- boolean
- Description
- Optional.
- Name
clientOrderId- Type
- string
- Description
- Mandatory dedup key.
0x+ 32 hex on HL; any non-empty string on Decibel.
- Name
tpTriggerPrice- Type
- string
- Description
- Decibel only — TP attached to this entry.
- Name
slTriggerPrice- Type
- string
- Description
- Decibel only — SL attached to this entry.
Request
await client.placeOrder({
venue: 'hl',
market: 'BTC',
side: 'buy',
size: '0.0003',
price: '50000',
tif: 'gtc',
clientOrderId: '0x...',
})
Response — OrderStatus
{
"orderId": "12345",
"clientOrderId": "0x...",
"venue": "hl",
"market": "BTC",
"side": "buy",
"size": "0.0003",
"price": "50000",
"tif": "gtc",
"filled": "0",
"remaining": "0.0003",
"state": "open",
"createdAt": 1779503000000
}
List open orders
Working orders, optionally filtered to one market.
Query
- Name
venue- Type
- string
- Description
- Required.
- Name
market- Type
- string
- Description
- Optional filter.
SDK
await client.openOrders({ venue: 'hl', market: 'BTC' })
// → OrderStatus[]
Cancel an order
Cancel by clientOrderId (DELETE /v1/orders) or by orderId (DELETE /v1/orders/{orderId}). Idempotent — a second cancel returns { status: "not_found" }, not an error.
SDK
await client.cancelOrder({ venue: 'hl', clientOrderId: '0x...' })
// → { status: "cancelled" | "not_found" }
Order status
Single-order lookup by venue order id.
SDK
await client.orderStatus({ venue: 'hl', orderId: '12345' })
// → OrderStatus
Cancel all
Bulk cancel, optionally filtered to one market. Returns a per-order breakdown.
SDK
await client.cancelAllOrders({ venue: 'decibel', market: 'BTC/USD' })
// → { cancelled, failed, failures: [...] }
Batch
Up to 20 orders in one action. Each result row is an OrderStatus (success) or a TriaError (per-order rejection — siblings still apply). HL is atomic at the matcher; Decibel runs parallel txs.
SDK
await client.placeBatch({ venue: 'hl', orders: [/* up to 20 */] })
// → Array<OrderStatus | TriaError>