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

[
  0, //CHAN_ID
  "miu", //MSG_TYPE
  [
    "base", //UPDATE_TYPE
    [
      -13.014640000000007, //USER_PL
      0, //USER_SWAPS
      49331.70267297, //MARGIN_BALANCE
      49318.68803297, //MARGIN_NET
      27 //MARGIN_REQUIRED
    ] //BASE_UPDATE_ARRAY
  ] //UPDATE_ARRAY
] 

// margin symbol calc
  
[
  0, //CHAN_ID
  "miu", //MSG_TYPE
  [
    "sym", //UPDATE_TYPE
    "tETHUSD", //SYMBOL
    [
      149361.09689202666, //TRADABLE_BALANCE
      149639.26293509, //GROSS_BALANCE
      830.0182168075556, //BUY
      895.0658432466332, //SELL
      null, //PLACEHOLDER
      null, //PLACEHOLDER
      null, //PLACEHOLDER
      null //PLACEHOLDER
    ] //SYM_UPDATE_ARRAY
  ] //UPDATE_ARRAY
] 

Margin info update data

IndexFieldTypeDescription
[0]CHAN_IDIntIdentification number assigned to the channel for the duration of this connection.
[1]MSG_TYPEString'miu' (margin info update)
[2]UPDATE_ARRAYArrayMargin info 'base' update or Margin info 'sym' update

Margin info 'base' update

IndexFieldTypeDescription
[0]UPDATE_TYPEStringSpecify the type of update: "base"
[1]BASE_UPDATE_ARRAYArrayBase update array

Margin info 'sym' update

IndexFieldTypeDescription
[0]UPDATE_TYPEStringSpecify the type of update: "base"
[1]SYMBOLStringSymbol for the update
[2]SYM_UPDATE_ARRAYArraySym update array

Base update arrays

IndexFieldTypeDescription
[0]USER_PLFloatUser profit and loss
[1]USER_SWAPSFloatAmount of swaps a user has
[2]MARGIN_BALANCEFloatBalance in your margin funding account
[3]MARGIN_NETFloatBalance after P&L is accounted for
[4]MARGIN_REQUIREDFloatMinimum required margin to keep positions open

Sym update arrays

IndexFieldTypeDescription
[0]TRADABLE_BALANCEFloatYour buying power (how large a position you can obtain)
[1]GROSS_BALANCEFloatYour buying power including funds already reserved for open positions
[2]BUYFloatMaximum amount you can buy at current best ASK
[3]SELLFloatMaximum amount you can sell at current best BID

📘

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.