Receive a snapshot and updates for any position events on your account.
Subscribe to the account information channel to keep track of your positions. The account information channel provides a snapshot and updates on the positions in your account. The snapshot is delivered upon subscribing and any changes to your positions will be provided as updates 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.
Position events are sent with CHAN_ID = 0 and can be identified by looking at the TYPE stream field. Positions events will use one of the following abbreviations: 'ps' (positions snapshot), 'pn' (position new), 'pu' (position update), and 'pc' (position close).
[
CHAN_ID,
TYPE, // 'ps'
[
[
SYMBOL,
STATUS,
AMOUNT,
BASE_PRICE,
MARGIN_FUNDING,
MARGIN_FUNDING_TYPE,
PL,
PL_PERC,
PRICE_LIQ,
LEVERAGE,
FLAG,
POSITION_ID,
MTS_CREATE,
MTS_UPDATE,
PLACEHOLDER,
TYPE,
PLACEHOLDER,
COLLATERAL,
COLLATERAL_MIN,
META
],
...
]
]
[0,"ps",[["tETHUST","ACTIVE",0.2,153.71,0,0,null,null,null,null,null,142420429,null,null,null,0,null,0,null,{"reason":"TRADE","order_id":34934099168,"order_id_oppo":34934090814,"liq_stage":null,"trade_price":"153.71","trade_amount":"0.2"}]]]
[
CHAN_ID,
TYPE, // <‘pn’, ’pu’, ‘pc’>
[
SYMBOL,
STATUS,
AMOUNT,
BASE_PRICE,
MARGIN_FUNDING,
MARGIN_FUNDING_TYPE,
PL,
PL_PERC,
PRICE_LIQ,
LEVERAGE,
FLAG,
POSITION_ID,
MTS_CREATE,
MTS_UPDATE,
PLACEHOLDER,
TYPE,
PLACEHOLDER,
COLLATERAL,
COLLATERAL_MIN,
META
]
]
[0,"pu",["tETHUST","ACTIVE",0.2,153.71,0,0,-0.07944800000000068,-0.05855181835925015,67.52755254906451,1.409288545397275,null,142420429,null,null,null,0,null,0,0,{"reason":"TRADE","order_id":34934099168,"order_id_oppo":34934090814,"liq_stage":null,"trade_price":"153.71","trade_amount":"0.2"}]]
Stream Fields
Term | Type | Description |
---|---|---|
CHAN_ID | int | Identification number for the channel subscribtion. Position events are always sent through the account information channel with CHAN_ID = 0 |
TYPE | string | 'ps' (position snapshot), 'pn' (position new), 'pu' (position update), 'pc' (position close) |
SYMBOL | string | Pair (tBTCUSD, …). |
STATUS | string | Status (ACTIVE, CLOSED). |
±AMOUNT | float | Size of the position. Positive values means a long position, negative values means a short position. 0 means position closed. |
BASE_PRICE | float | The price at which you entered your position. |
MARGIN_FUNDING | float | The amount of funding being used for this position. |
MARGIN_FUNDING_TYPE | int | 0 for daily, 1 for term. |
PL | float | Profit & Loss |
PL_PERC | float | Profit & Loss Percentage |
PRICE_LIQ | float | Liquidation price ('null' if the value is not updated yet (see notice below)) |
LEVERAGE | float | Beta value |
POSITION_ID | int | Position ID |
MTS_CREATE | int | Millisecond timestamp of creation |
MTS_UPDATE | int | Millisecond timestamp of update |
TYPE | int | Identifies the type of position, 0 = Margin position, 1 = Derivatives position |
COLLATERAL | float | The amount of collateral applied to the open position |
COLLATERAL_MIN | float | The minimum amount of collateral required for the position |
META | json string | Additional meta information about the position |
NOTE
These messages have gained the ability to send the calculation values (liquidation price). If the value is equal to "null" this means that the newly calculated value is not yet available.
A calc request can be sent to request that the value be updated. See calc input dedicated section for more details.