跳到主要内容

合约Balance和Position更新推送

事件描述

账户更新事件的 event type 固定为 ACCOUNT_UPDATE

  • 当账户信息有变动时,会推送此事件:

    • 仅当账户信息有变动时(包括资金、仓位、保证金模式等发生变化),才会推送此事件;
    • 订单状态变化没有引起账户和持仓变化的,不会推送此事件;
    • position 信息:仅当symbol仓位有变动时推送。
  • "FUNDING FEE" 引起的资金余额变化,仅推送简略事件:

    • 当用户某全仓持仓发生"FUNDING FEE"时,事件ACCOUNT_UPDATE将只会推送相关的用户资产余额信息B(仅推送FUNDING FEE 发生相关的资产余额信息),而不会推送任何持仓信息P
    • 当用户某逐仓仓持仓发生"FUNDING FEE"时,事件ACCOUNT_UPDATE将只会推送相关的用户资产余额信息B(仅推送"FUNDING FEE"所使用的资产余额信息),和相关的持仓信息P(仅推送这笔"FUNDING FEE"发生所在的持仓信息),其余持仓信息不会被推送。
  • 字段"m"代表了事件推出的原因,包含了以下可能类型:

    • DEPOSIT
    • WITHDRAW
    • ORDER
    • FUNDING_FEE
    • WITHDRAW_REJECT
    • ADJUSTMENT
    • INSURANCE_CLEAR
    • ADMIN_DEPOSIT
    • ADMIN_WITHDRAW
    • MARGIN_TRANSFER
    • MARGIN_TYPE_CHANGE
    • ASSET_TRANSFER
    • OPTIONS_PREMIUM_FEE
    • OPTIONS_SETTLE_PROFIT
    • AUTO_EXCHANGE
    • COIN_SWAP_DEPOSIT
    • COIN_SWAP_WITHDRAW
  • 字段"bc"代表了钱包余额的改变量,即 balance change,但注意其不包含仓位盈亏及交易手续费。

事件类型

ACCOUNT_UPDATE

更新速度类型

50ms

响应示例

{
"e": "ACCOUNT_UPDATE", // Event Type
"fs": "UM", // Event business unit. 'UM' for USDS-M futures and 'CM' for COIN-M futures
"E": 1564745798939, // Event Time
"T": 1564745798938 , // Transaction
"i":"", // Account Alias, ignore for UM
"a": // Update Data
{
"m":"ORDER", // Event reason type
"B":[ // Balances
{
"a":"USDT", // Asset
"wb":"122624.12345678", // Wallet Balance
"cw":"100.12345678", // Cross Wallet Balance
"bc":"50.12345678" // Balance Change except PnL and Commission
},
{
"a":"BUSD",
"wb":"1.00000000",
"cw":"0.00000000",
"bc":"-49.12345678"
}
],
"P":[
{
"s":"BTCUSDT", // Symbol
"pa":"0", // Position Amount
"ep":"0.00000", // Entry Price
"cr":"200", // (Pre-fee) Accumulated Realized
"up":"0", // Unrealized PnL
"ps":"BOTH", // Position Side
"bep":"0.00000" // breakeven price},
},
{
"s":"BTCUSDT",
"pa":"20",
"ep":"6563.66500",
"cr":"0",
"up":"2850.21200",
"ps":"LONG",
"bep":"0.00000" // breakeven price
}
]
}
}