Margin Info

Receive margin info updates for your account.

Subscribe to the account information channel to keep track of your margin info. The account information channel will provide a feed of your margin info for as long as the channel remains open. Any authenticated connection is automatically subscribed to the account information channel.

Example code to open an authenticated connection can be found on our Authenticated Channels Page.

Margin info events are sent with CHAN_ID = 0 and can be identified by looking at the TYPE stream field. Margin info events can be recognised by the 'miu' (margin info update) abbreviation.

// margin base calc
[
  CHAN_ID,
  TYPE, // 'miu'
  [
    'base',
    [
      USER_PL, 
      USER_SWAPS, 
      MARGIN_BALANCE, 
      MARGIN_NET,
      MARGIN_REQUIRED
      ...
    ]
   ]
]

[0,"miu",["base",[-13.014640000000007,0,49331.70267297,49318.68803297,27]]]

// margin symbol calc
[
  CHAN_ID,
  TYPE, // 'miu'
  [
    'sym',
    SYMBOL,
    [
      TRADABLE_BALANCE,
      GROSS_BALANCE,
      BUY,
      SELL,
      ...
    ]
   ]
]
  
[0,"miu",["sym","tETHUSD",[149361.09689202666,149639.26293509,830.0182168075556,895.0658432466332,null,null,null,null]]]

Stream Fields

TermTypeDescription
CHAN_IDintIdentification number for the channel subscribtion. Margin info events are always sent through the account information channel with CHAN_ID = 0
TYPEstring'miu' (margin info update)
USER_PLfloatUser Profit and Loss
USER_SWAPSfloatAmount of swaps a user has
SYMBOLstringThe symbol the information pertains to
TRADABLE_BALANCEfloatYour buying power (how large a position you can obtain)
MARGIN_BALANCEfloatBalance in your margin funding account
MARGIN_NETfloatBalance after P&L is accounted for
MARGIN_REQUIREDfloatMinimum required margin to keep positions open

📘

NOTE

These messages have gained the ability to send the calculation values equal to "null" meaning that the new calculated value is not yet available.
In order to receive those values the user have to actively request for it with a "calc" message.
See calc input dedicated section for more details.