Skip to main content

Poll by transaction hash

const orders = await client.getOrders({
  initiatedTxHashes: [txHash],
});

Query by order id

const orders = await client.getOrders({ orderIds: [123] });

Filter order history

Without filters, OstiumClient.getOrders() returns recent orders for the connected trader. Pass user: 'ALL' to remove the trader filter and fetch global orders. When builder is provided without user, the SDK does not add the connected-trader default.
const globalOrders = await client.getOrders({ user: 'ALL' });

const builderOrders = await client.getOrders({
  builder: '0xBuilderAddress',
});

const pendingBtcOrders = await client.getOrders({
  isPending: true,
  pairIds: ['0'],
});

const ordersExecutedToday = await client.getOrders({
  user: 'ALL',
  start: 1765411200,
  end: 1765497599,
});

const cancelledBuilderOrders = await client.getOrders({
  user: 'ALL',
  builder: '0xBuilderAddress',
  isCanceled: true,
});
orderIds and initiatedTxHashes are mutually exclusive. The other filters can be combined. start and end filter by execution time (executedAt) as Unix seconds UTC with inclusive bounds. Pending orders do not have execution time, so combining start or end with isPending: true returns no executed-time matches. For builder analytics that should include sibling close, TP, and SL orders on the same positions, use getBuilderOrders.

Parameters

interface GetOrdersParams {
  orderIds?: Array<string | number>;
  initiatedTxHashes?: readonly `0x${string}`[];
  user?: `0x${string}` | 'ALL';
  builder?: string;
  isPending?: boolean;
  isCanceled?: boolean;
  isCancelled?: boolean;
  pairIds?: Array<string | number>;
  start?: number;
  end?: number;
  limit?: number;
}

Response schema

type Response = Array<{
  pairTo: string;
  pairFrom: string;
  pairId: string;
  oid: string;
  pid: string;
  trader: string;
  side: 'B' | 'S';
  action: 'Open' | 'Close' | 'Liquidation' | 'StopLoss' | 'TakeProfit' | 'RemoveCollateral' | 'CloseDayTrade';
  type: 'Market' | 'Limit' | 'REMOVE_COLLATERAL';
  px: string;
  szi: string;
  ntl: string;
  collateralUsed: string;
  builder: string;
  fees: {
    opening: string;
    rollover: string;
    liquidation: string;
    builder: string;
    priceImpact: string;
  };
  closedPnl: string;
  hash: string;
  time: number;
  timestamp: number;
  initiatedTx: string;
  initiatedTime: number;
  isPending: boolean;
  isCancelled: boolean;
  cancelReason?: string;
  initiatedBlock?: string;
}>;