TESTNET
Markets
Trade
Lending Vaults
More
User Docs Developer Docs Sdk API Docs Help
Overview
Overview
Architecture
Authentication
Client configuration
Overview
Environments
Installation
Market data
Market data services
Authentication model
Quickstart
Trading
Trading services
Account services
Catalog & precision
Streaming
Accounts & balances
Funding services
Deposits & withdrawals
Realtime client
Errors
Server-side usage
Error handling
  1. Typescript
  2. /
  3. Trading services

Trading services

All services on this page use the authenticated transport. Every input accepts an optional account field ("main" · "active" · { subaccountId }) — see Accounts & balances. Methods marked stream return () => void and take onEvent (+ optional onOpen / onClose / onError).

client.orders

Method Input → Result Notes
create(input, options?) NewOrderInput → CreateOrderResult Validated against pair constraints client-side.
modify(input, options?) ModifyOrderInput → ModifyOrderResult Price/qty/client-id/risk patch; auto-generates requestId.
cancel(input, options?) { orderId } or { clientOrderId }, symbolId? → CancelOrderResult
cancelAll(input, options?) symbol?, side?, dryRun?, maxOrders?, requestId? → CancelAllOrdersResponse dryRun previews without cancelling.
listOpen(input?, options?) symbol?, side?, pagination, risk-inclusion filters → { orders, nextPageToken }
listHistory(input?, options?) + status?, time range → { orders, nextPageToken }
getDetails(input, options?) { orderId } or { clientOrderId } → OrderDetails | null Order + trades + transfers.
subscribe(input) accountId → stream of Order

NewOrderInput

Field Type Required Notes
symbol string ✓ Pair symbol, e.g. "BTC-USDC".
side "buy" | "sell" ✓
orderType "limit" | "market" ✓
timeInForce "gtc" | "ioc" | "fok" ✓
qty decimal string ✓ Base-asset quantity; strict precision.
price decimal string limit only Strict precision (6 dp).
postOnly boolean Default false.
clientOrderId string (≤ 64) Idempotency key.
feeSource "quote" | "received"
selfTradePreventionMode "expire_taker" | "expire_maker" | "expire_both"
risk RiskPolicyInput Attached TP/SL/trailing legs (below).
marketMaxSlippage distance/bps/none market only
marketClientRefPrice decimal string market only Reference price for slippage.
account AccountScope Scope override.

RiskPolicyInput

Valid combinations: takeProfit + stopLoss, takeProfit + trailingStop, or any single leg; plus oco?: boolean for one-cancels-other.

  • takeProfit / stopLoss: { triggerPrice, triggerPriceSource? ("last"|"index"|"mark"), orderType?, limitPrice? }
  • trailingStop: { trailingDistance, maxSlippage?, activationPrice?, triggerPriceSource?, orderType? }
  • Distances/slippage take { kind: "distance", distance: "500" }, { kind: "slippage", slippage: "0.25" }, { kind: "bps", bps: 50 }, or { kind: "none" }.

ModifyOrderInput

Key: { orderId } or { clientOrderId }. Base: symbol (required), requestId?, newClientOrderId?, behavior?. Patch: newPrice? and/or newQty?; risk: risk (replace) or clearRisk: true — mutually exclusive.

client.triggers

Standalone automations that place a child order when a condition fires. Types: stop_loss, take_profit, trailing_stop, twap, ladder.

Method Input → Result Notes
create(input, options?) CreateTriggerInput (variant on triggerType) → CreateTriggerResult clientTriggerId auto-generated when omitted.
get(input, options?) triggerId → Trigger | null
list(input?, options?) symbol?, status/type/parent-order filters, pagination → ListTriggersResult Newest first.
modify(input, options?) triggerId + ≥ 1 of triggerPrice, limitPrice, trailingDistance, activationPrice, maxSlippage → ModifyTriggerResult
pause(input, options?) / resume(input, options?) triggerId → result
cancel(input, options?) triggerId → CancelTriggerResult
listEvents(input, options?) triggerId, limit? (default 50) → ListTriggerEventsResult Fire/cancel/update/child-order events, newest first.
subscribe(input) accountId → stream of Trigger state
subscribeEvents(input) accountId → stream of lifecycle events

CreateTriggerInput

Common child-order fields for every type: symbol, side, orderType, timeInForce, qty, limitPrice?, postOnly?, feeSource?, selfTradePreventionMode?, clientTriggerId?, account?.

Per-type additions:

triggerType Extra fields
"stop_loss" / "take_profit" triggerPrice, triggerPriceSource?
"trailing_stop" trailingDistance, activationPrice?, maxSlippage?, triggerPriceSource?
"twap" Duration/interval controls for time-sliced execution
"ladder" ladderPriceMin, ladderPriceMax, ladderLevels (2–100), ladderDistribution? ("linear" default)

client.trades

Your fills.

Method Input → Result Notes
list(input?, options?) symbol?, side?, time range, limit?, pageToken? → { trades, nextPageToken }
subscribe(input) accountId → stream of trades

All prices/quantities in results are decimal strings; orders on symbols missing from the catalog are filtered out of list responses rather than failing the whole page.

Previous

Trading

Next

Account services

  • client.orders
  • NewOrderInput
  • RiskPolicyInput
  • ModifyOrderInput
  • client.triggers
  • CreateTriggerInput
  • client.trades