Post-Trade Settlement

Receive real-time updates to your account's credit and risk metrics.

Refer to the Support Center for more information regarding risk management and risk metrics for Post-Trade Settlement (note: you may be asked to sign in to your sFOX account before being redirected to the support center)

Subscribing

Feed name

private.user.post-trade-settlement

// Request -> post-trade settlement feed
{
    "type": "subscribe", 
    "feeds": ["private.user.post-trade-settlement"]
}

The initial response payload will include a snapshot of your account's current credit and risk metric data.

Post-Trade Settlement Message

Messages are only sent when a transaction is executed. However, please note that asset price changes may impact your risk metrics.

Post-Trade Settlement Object

Key
Type
Description

enabled

boolean

Boolean whether post-trade settlement is enabled for your account

equity

string

Collateralization–The "liquidation value" of your portfolio–the USD value of your assets if all of your holdings were converted to USD.

equity_for_withdrawals

string

Your "Free Equity." The portion of your Equity that could be removed from your account (e.g. for a withdrawal) without triggering liquidation.

exposure

string

Your current total net open position (NOP) across currencies/markets–the USD value of your positions pending settlement.

available_exposure

string

Credit available before hitting your Exposure Limit.

exposure_limit

string

The maximum USD value of your total net open positions (NOPs) across currencies/markets.

liquidation_level

string

If your Equity Level drops below this level, your positions will be partially settled automatically.

Post-Trade Settlement Message

// Post-trade settlement message
{
    "sequence": 3,
    "recipient": "private.user.post-trade-settlement",
    "timestamp": 1727392002153041890,
    "payload": {
        "enabled": true,
        "equity": "81306152.88083515",
        "equity_for_withdrawals": "81286273.68856692",
        "exposure": "0",
        "available_exposure": "250000",
        "exposure_limit": "250000",
        "liquidation_level": "0.1"
    }
}

Example Code & Post-Trade Settlement Message

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 balances feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['private.user.post-trade-settlement']
}

ws.send(JSON.stringify(subscribeMsg))

Last updated