Skip to main content
Requires authentication.
The Orders resource provides order entry and management capabilities for trading on markets.

Methods

MethodEndpointDescription
create(params)POST /v1/ordersCreate a new order
list(params?)GET /v1/orders/openGet open orders
retrieve(orderId)GET /v1/order/{orderId}Get order by ID
cancel(orderId, params)POST /v1/order/{orderId}/cancelCancel an order
modify(orderId, params)POST /v1/order/{orderId}/modifyModify an order
cancelAll(params?)POST /v1/orders/open/cancelCancel all open orders
preview(params)POST /v1/order/previewPreview order before submission
closePosition(params)POST /v1/order/close-positionClose an existing position

create

Create a new order on a market.
const order = await client.orders.create({
  marketSlug: 'btc-100k-2025',
  intent: 'ORDER_INTENT_BUY_LONG',
  type: 'ORDER_TYPE_LIMIT',
  price: { value: '0.55', currency: 'USD' },
  quantity: 100,
  tif: 'TIME_IN_FORCE_GOOD_TILL_CANCEL',
});

console.log(`Order ID: ${order.id}`);
console.log(`State: ${order.state}`);

Parameters

ParameterTypeRequiredDescription
marketSlugstringYesMarket to trade
intentstringYesOrder intent (see below)
typestringYesORDER_TYPE_LIMIT or ORDER_TYPE_MARKET
priceAmountLimit onlyLimit price
quantitynumberYesNumber of contracts
tifstringYesTime in force (see below)

Order Intent

ValueDescription
ORDER_INTENT_BUY_LONGBuy YES shares
ORDER_INTENT_SELL_LONGSell YES shares
ORDER_INTENT_BUY_SHORTBuy NO shares
ORDER_INTENT_SELL_SHORTSell NO shares

Time in Force

ValueDescription
TIME_IN_FORCE_GOOD_TILL_CANCELRemains active until filled or canceled
TIME_IN_FORCE_GOOD_TILL_DATEExpires at specified time
TIME_IN_FORCE_IMMEDIATE_OR_CANCELFill immediately available quantity, cancel rest
TIME_IN_FORCE_FILL_OR_KILLFill entirely or cancel completely

list

Get all open orders.
const orders = await client.orders.list();

for (const order of orders.orders) {
  console.log(`${order.id}: ${order.marketSlug} - ${order.state}`);
}

cancel

Cancel a specific order.
await client.orders.cancel('order-id-123', {
  marketSlug: 'btc-100k-2025',
});

cancelAll

Cancel all open orders, optionally filtered by market.
const result = await client.orders.cancelAll();
console.log(`Canceled: ${result.canceledOrderIds}`);

// Or cancel for a specific market
const result = await client.orders.cancelAll({ marketSlug: 'btc-100k-2025' });

preview

Preview an order before submitting. Returns estimated fills and costs.
const preview = await client.orders.preview({
  marketSlug: 'btc-100k-2025',
  intent: 'ORDER_INTENT_BUY_LONG',
  type: 'ORDER_TYPE_LIMIT',
  price: { value: '0.55', currency: 'USD' },
  quantity: 100,
});

console.log(`Estimated Cost: $${preview.estimatedCost}`);

closePosition

Close an existing position at market price. This sells your entire position in a single call.
const result = await client.orders.closePosition({
  marketSlug: 'btc-100k-2025',
});

closePosition vs Sell Order

closePositionSell Order (create)
Position sizeEntire positionAny quantity
Order typeMarket onlyLimit or market
Use caseQuick full exitPartial sells, limit prices
Use closePosition when you want to fully exit a position at market price. Use a sell order (ORDER_INTENT_SELL_LONG or ORDER_INTENT_SELL_SHORT) when you need to sell a specific quantity or set a limit price.

Slippage Tolerance

For market orders and close position, you can specify slippage tolerance:
const result = await client.orders.closePosition({
  marketSlug: 'btc-100k-2025',
  slippageTolerance: {
    currentPrice: { value: '0.50', currency: 'USD' },
    ticks: 5,
  },
});

Order States

Orders progress through these states:
StateDescription
ORDER_STATE_PENDING_NEWReceived, not yet processed
ORDER_STATE_PARTIALLY_FILLEDPartially executed
ORDER_STATE_FILLEDFully executed
ORDER_STATE_CANCELEDCanceled
ORDER_STATE_REJECTEDRejected by exchange
ORDER_STATE_EXPIREDExpired (GTD orders)
For real-time order updates, use the WebSocket with SUBSCRIPTION_TYPE_ORDER instead of polling.