API Reference

Order Settlement Update and Reversion Updates

Order Settlement Update

OrderSettlementUpdate socket event is triggered when an order is sent for settlement on-chain. By receiving the OrderSettlementUpdate socket event, users can stay informed about the progress of their orders to ensure transparency - specifically, that their order has been matched and sent for settlement.

{ 
  event: string,                      // event type
  userAddress: string,                // user's public address
  message: string,                    // message
  orderHash: string,                  // hash of the relevant order
  orderQuantity: string,              // quantity of the relevant order
  quantitySentForSettlement: string,  // quantity that has been matched
  symbol: string,                     // perpetual market (eg. BTC-PERP)
  timestamp: number,                  // timstamp in milliseconds
  isMaker: boolean,                   // flag indicating whether order is maker or taker
  isBuy: boolean,											// flag indicating whether order is buy or sell
  avgFillPrice: string,               // average price across all matched orders
  fillId: string,                     // unique fillId for each partial or complete order fill
  matchedOrders:[                     // array of matched order metadata
    {
      fillPrice: string,              // price of matched order
      quantity: string,               // quantity of matched order
    }
  ]
}

📘

Note

The OrderSettlementUpdate event is meant to inform you on when your order has (partially or fully) left the orderbook and is awaiting to be filled on-chain - it is not an official order status update - and can be used to maintain a more granular view of where your order is in its trade lifecycle.

If you would like more details on what this means and relevant edge cases, you can read more in the Order Statuses & Best Practices section.


Order Requeue Update

OrderRequeueUpdate socket event is triggered when an order's settlement has failed and the order is being re-queued to be added back to the order book. When an order gets matched, the user will receive a socket event notifying them that their order has been sent for settlement. However, settlement can fail for various reasons. In such cases, valid orders that encounter settlement failures are re-queued to be added to the order book again.

{
  event: string,                   // event type
  orderHash: string,               // quantity of the relevant order
  userAddress: string,             // user's public address
  symbol: string,                  // perpetual market (eg. BTC-PERP)
  message: string,                 // message
  isBuy: boolean,									 // flag indicating whether order is buy or sell
  quantitySentForRequeue: string,  // quantity that is being requeued for matching
  fillId: string,                  // unique fillId for each partial or complete order fill
  timestamp: number,               // timstamp in milliseconds
}

📘

Note

The OrderRequeueUpdate event is meant to inform you on when your previously matched order has failed to fill on-chain and is being requeued back into the orderbook - it is not an official order status update - and can be used to maintain a more granular view of where your order is in its trade lifecycle.

If you would like more details on what this means and relevant edge cases, you can read more in the Order Statuses & Best Practices section.


Order Cancellation On Reversion Update

OrderCancelledOnReversionUpdate socket event is triggered when an order's settlement has failed and the order is being cancelled from the order book. When an order gets matched, the user will receive a socket event notifying them that their order has been sent for settlement. However, settlement can fail for various reasons. In such cases, invalid orders that encounter settlement failures are cancelled from the order book. Another reason could be due to cancel_on_revert flag being true which identifies the order as to be cancelled when reversion happens.

{
  event: string,                        // event type
  orderHash: string,                    // quantity of the relevant order
  userAddress: string,                  // user's public address
  symbol: string,                       // perpetual market (eg. BTC-PERP)
  message: string,                      // message
  isBuy: boolean,									      // flag indicating whether order is buy or sell
  quantitySentForCancellation: string,  // quantity that is reverted from chain after matching
  fillId: string,                       // unique fillId for each partial or complete order fill
  timestamp: number,                    // timstamp in milliseconds
}

📘

Note

The OrderCancelledOnReversionUpdate event is meant to inform you on when your previously matched order has failed to fill on-chain and is being cancelled from the orderbook - it is not an official order status update - and can be used to maintain a more granular view of where your order is in its trade lifecycle.

If you would like more details on what this means and relevant edge cases, you can read more in the Order Statuses & Best Practices section.