Orders

Receive real-time updates regarding open orders you've placed in your account.

Updates include any change to an open order e.g. order creation, partial fills, status changes, amendments, etc.

Subscribing

Feed name

private.user.open-orders

// Request -> orders feed
{
    "type": "subscribe", 
    "feeds": ["private.user.open-orders"]
}

Orders Message

//Orders feed message
{
  "sequence": 5,
  "recipient": "private.user.open-orders",
  "timestamp": 1649903305545835513,
  "payload": [{
    "id": 693291242,
    "client_order_id": "577ab261-9dfc-415a-ba61-a54a18c1942c",
    "date_added": "2023-11-14T22:08:53.000Z",
    "status": "Started",
    "filled": "0.00035333",
    "filled_amount": "14.61628778",
    "vwap": "41367.24246455",
    "price": "37227.82",
    "quantity": "0.05",
    "pair": "btcusd",
    "action": "Sell",
    "type": "TWAP",
    "algorithm_id": 307,
    "fees": "0.02850176"
  }]
}

Example Code

const WebSocket = require('ws')

const ws = new WebSocket('wss://ws.sfox.com/ws')

ws.on('open', function() {
  const authMessage = {
   type: 'authenticate',
   apiKey: '<API_KEY>',
  }
  
  ws.send(JSON.stringify(authMessage))
})

// After successful authentication, subscribe to open orders feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['private.user.open-orders']
}

ws.send(JSON.stringify(subscribeMsg))

Last updated