Disclaimer: In compliance with MiCA requirements, unauthorized stablecoins are subject to certain restrictions for EEA users. For more information, please click here.
1. When an asset of a user is changed:
2. When a position of a symbol is changed, or the margin type of a symbol is changed:
3. In short, the full information of assets and positions should be obtained via the related rest endpoints (GET /fapi/v2/account and GET /fapi/v2/positionRisk), and the locally cached asset or position data can be updated via the event ACCOUNT_UPDATE in Websocket USER-DATA-STREAM with the information of changed asset or position.
Consider a user holds 94.89888561 USDT and 0.01575839 BNB in his Futures Wallet and 0.01 BTCUSDT in the LONG position and -0.01 ETHUSDT in the SHORT position. If the user:
Before upgrade | After upgrade |
{ "e":"ACCOUNT_UPDATE", "T":1603093193280, "E":1603093193284, "a":{ "B":[ { "a":"USDT", "wb":"94.91018561", "cw":"93.70831461" }, { "a":"BNB", "wb":"0.02575839", "cw":"0" } ], "P":[ { "s":"BTCUSDT", "pa":"0", "ep":"0.00000", "cr":"-147.28880096", "up":"0", "mt":"isolated", "iw":"0", "ps":"BOTH" }, { "s":"BTCUSDT", "pa":"0.010", "ep":"11445.71000", "cr":"-23.20024001", "up":"0.17770", "mt":"isolated", "iw":"1.20187100", "ps":"LONG" }, { "s":"BTCUSDT", "pa":"0", "ep":"0.00000", "cr":"-6.04296000", "up":"0", "mt":"isolated", "iw":"0", "ps":"SHORT" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.00057000", "up":"0", "mt":"cross", "iw":"0", "ps":"BOTH" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-385.79173997", "up":"0", "mt":"cross", "iw":"0", "ps":"LONG" }, { "s":"ETHUSDT", "pa":"-0.010", "ep":"375.74000", "cr":"-0.19160000", "up":"0.00149", "mt":"cross", "iw":"0", "ps":"SHORT" } ], "m":"DEPOSIT" } } | { "e":"ACCOUNT_UPDATE", "T":1603093193280, "E":1603093193284, "a":{ "B":[ // USDT is not pushed as there is no balance change { "a":"BNB", // BNB is pushed as the balance is updated. "wb":"0.02575839", "cw":"0" } ], "P":[], // No position data is pushed as there is no position change. "m":"DEPOSIT" } } |
2. Closes the ETHUSDT short position
Before upgrade | After upgrade |
{ "e":"ACCOUNT_UPDATE", "T":1603093588546, "E":1603093588553, "a":{ "B":[ { "a":"USDT", "wb":"94.91428561", "cw":"93.71241461" }, { "a":"BNB", "wb":"0.02571331", "cw":"0" } ], "P":[ { "s":"BTCUSDT", "pa":"0", "ep":"0.00000", "cr":"-147.28880096", "up":"0", "mt":"isolated", "iw":"0", "ps":"BOTH" }, { "s":"BTCUSDT", "pa":"0.010", "ep":"11445.71000", "cr":"-23.20024001", "up":"0.13910", "mt":"isolated", "iw":"1.20187100", "ps":"LONG" }, { "s":"BTCUSDT", "pa":"0", "ep":"0.00000", "cr":"-6.04296000", "up":"0", "mt":"isolated", "iw":"0", "ps":"SHORT" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.00057000", "up":"0", "mt":"cross", "iw":"0", "ps":"BOTH" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-385.79173997", "up":"0", "mt":"cross", "iw":"0", "ps":"LONG" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.18750000", "up":"0", "mt":"cross", "iw":"0", "ps":"SHORT" } ], "m":"ORDER" } } | { "e":"ACCOUNT_UPDATE", "T":1603093588546, "E":1603093588553, "a":{ "B":[ { "a":"USDT", // USDT is pushed because it's changed by Realized PNL. "wb":"94.91428561", "cw":"93.71241461" }, { "a":"BNB", // BNB is pushed because it's changed by BNB trading fee burn. "wb":"0.02571331", "cw":"0" } ], "P":[ // Only the changed position of ETHUSDT is pushed. { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.00057000", "up":"0", "mt":"cross", "iw":"0", "ps":"BOTH" // BOTH positions will always be pushed. }, // LONG position is not pushed because it's not initialized yet. { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.18750000", "up":"0", "mt":"cross", "iw":"0", "ps":"SHORT" // SHORT position is pushed as it's changed from this event. } ], "m":"ORDER" } } |
3. Changes ETHUSDT from CROSS to ISOLATED mode
Before upgrade | After upgrade |
{ "e":"ACCOUNT_UPDATE", "T":1603094890011, "E":1603094890017, "a":{ "B":[ { "a":"USDT", "wb":"94.90282656", "cw":"93.71241461" }, { "a":"BNB", "wb":"0.02571331", "cw":"0" } ], "P":[ { "s":"BTCUSDT", "pa":"0", "ep":"0.00000", "cr":"-147.28880096", "up":"0", "mt":"isolated", "iw":"0", "ps":"BOTH" }, { "s":"BTCUSDT", "pa":"0.010", "ep":"11445.71000", "cr":"-23.20024001", "up":"0.03240", "mt":"isolated", "iw":"1.19041195", "ps":"LONG" }, { "s":"BTCUSDT", "pa":"0", "ep":"0.00000", "cr":"-6.04296000", "up":"0", "mt":"isolated", "iw":"0", "ps":"SHORT" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.00057000", "up":"0", "mt":"isolated", "iw":"0", "ps":"BOTH" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-385.79173997", "up":"0", "mt":"isolated", "iw":"0", "ps":"LONG" }, { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.18750000", "up":"0", "mt":"isolated", "iw":"0", "ps":"SHORT" } ], "m":"MARGIN_TYPE_CHANGE" } } | { "e":"ACCOUNT_UPDATE", "T":1603094890011, "E":1603094890017, "a":{ "B":[ { "a":"USDT", // USDT is pushed because it's margin asset. "wb":"94.90282656", "cw":"93.71241461" } ], "P":[ // only ETHUSDT is pushed as it has mode change ( CROSS to ISOLATED). { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.00057000", "up":"0", "mt":"isolated", "iw":"0", "ps":"BOTH" // BOTH positions will always be pushed. }, // LONG position is not pushed because it's not initialized yet. { "s":"ETHUSDT", "pa":"0", "ep":"0.00000", "cr":"-0.18750000", "up":"0", "mt":"isolated", "iw":"0", "ps":"SHORT" // SHORT is pushed as it's been initialised. } ], "m":"MARGIN_TYPE_CHANGE" } } |