Balances

Real-time streaming updates to your account balances

Subscription Instructions

Authentication required. Please refer to the WebSocket Authentication page here for more details.

Feed Name

private.user.balances

Balances Payload Details

KeyDescription

currency

The currency

balance

The total balance of this currency in your account across all wallets outlined below

available

The portion of the balance that is available for trading or withdrawals

held

Potion of the balance that is currently on hold and unavailable for trading or withdrawals (i.e. an ACH deposit that has yet to settle)

borrow_wallet

Amount of the currency , represented as the borrow wallet balance

collateral_wallet

Amount of the current being held as collateral in your collateral wallet

lending_wallet

Amount of the currency in your lending wallet

trading_wallet

Amount of the currency in your trading wallet

Web3 Balances Payload Details

KeyDescription

address

The web3 wallet address

balance

The total balance of this currency in your web3 wallet

network

The token network

type

Specifies the balance type i.e. web3

Example Code & Balances 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.balances']
}

ws.send(JSON.stringify(subscribeMsg))

Last updated