Balances

The balances feed tracks account balance updates across all of your users' accounts.

A balance update from this feed will include the user_id of the user to use to identify which user's account the update is for as well as this user's current balances across all currencies in the account.

Subscription Instructions

Feed Name

private.enterprise.users.balances

Key
Description

user_id

Unique shared ID you generated for the End User account

currency

The currency

balance

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

available

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 e.g. an ACH deposit that has yet to settle

trading_wallet

Amount of the currency in your trading wallet

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

Example Code

const WebSocket = require('ws')

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

ws.on('open', function() {
  const authMessage = {
   type: 'authenticate',
   apiKey: `${process.env.ENTERPRISE_API_KEY}`,
   enterprise: 'true'
  }
  
  ws.send(JSON.stringify(authMessage))
})

// After successful authentication, subscribe to user balances feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['private.enterprise.users.balances']
}

ws.send(JSON.stringify(subscribeMsg))

Last updated