Account balances and margins

This subscription feed returns balance and margin information for the user account

Authentication is required.

Feed

Event Type

API Keys Original & Signed Challenge
account_balances_and_margins
subscribe / unsubscribe
Any Yes
Sample sent message
{  
    "event":"subscribe",
    "feed":"account_balances_and_margins",
    "api_key":"CMl2SeSn09Tz+2tWuzPiPUjaXEQRGq6qv5UaexXuQ3SnahDQU/gO3aT+",
    "original_challenge":"226aee50-88fc-4618-a42a-34f7709570b2",
    "signed_challenge":"RE0DVOc7vS6pzcEjGWd/WJRRBWb54RkyvV+AZQSRl4+rap8Rlk64diR+
Z9DQILm7qxncswMmJyvP/2vgzqqh+g=="

}

 

Sample return if successful

{  
    "event":"subscribed",
    "feed":"account_balances_and_margins",
    "api_key":"CMl2SeSn09Tz+2tWuzPiPUjaXEQRGq6qv5UaexXuQ3SnahDQU/gO3aT+",
    "original_challenge":"226aee50-88fc-4618-a42a-34f7709570b2",
    "signed_challenge":"RE0DVOc7vS6pzcEjGWd/WJRRBWb54RkyvV+AZQSRl4+rap8Rlk64diR+
Z9DQILm7qxncswMmJyvP/2vgzqqh+g=="

} 

Field

Type Description
event
string The result, subscribed or subscribed_failed or
unsubscribed or unsubscribed_failed
feed string The requested subscription feed
api_key string The user api key
original_challege string The message that is received from a challenge request
signed_challege string The signed challenge message with user api secret

 

Sample subscription data
{  
   'seq':4786,
   'feed':'account_balances_and_margins',
   'margin_accounts':[  
      {  
         'name':'xbt',
         'pv':0.0,
         'balance':4.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      },
      {  
         'name':'xrp',
         'pv':0.0,
         'balance':3,000.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      },
      {  
         'name':'eth',
         'pv':0.0,
         'balance':13.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      },
      {  
         'name':'ltc',
         'pv':0.0,
         'balance':0.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      },
      {  
         'name':'bch',
         'pv':0.0,
         'balance':10.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      },
      {  
         'name':'f-xbt:usd',
         'pv':96.74,
         'balance':99.93704565,
         'funding':-0.008069,
         'mm':1.969,
         'pnl':-3.18821611,
         'im':5.048,
         'am':91.6927
      },
      {  
         'name':'f-xrp:xbt',
         'pv':5.1,
         'balance':5.1,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':5.1
      },
      {  
         'name':'f-xrp:usd',
         'pv':0.0,
         'balance':0.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      },
      {  
         'name':'f-eth:usd',
         'pv':8.23,
         'balance':8.23,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':8.23
      },
      {  
         'name':'f-ltc:usd',
         'pv':0.0,
         'balance':0.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      },
      {  
         'name':'f-bch:usd',
         'pv':0.0,
         'balance':0.0,
         'funding':0.0,
         'mm':0.0,
         'pnl':0.0,
         'im':0.0,
         'am':0.0
      }
   ],
   'account':'DemoUser'
}

 

Field

Type Description
feed string The subscribed feed
account string The user account name
seq positive integer  The subscription message sequence number
margin_accounts list of structures A list containing the margin account structures
name string

The name of the account

balance positive float

The current balance of the account

pnl float The profit and loss of the account
pv positive float

The portfolio value calculated as balance plus unrealized pnl value

am positive float

The available margin for opening new positions

im positive float

The initial margin for open positions and orders

mm positive float

The maintenance margin for open positions

 

 

Sample return if unsuccessful 
{  
    "event":"error",
    "message":"Invalid product id"
}

Field

Type Description
event string Always error
message string

An error message out of:

  • Invalid feed
  • Json Error