Files
ritmex-bot/docs/binance/binance_derivatives/docs_derivatives_usds-margined-futures_user-data-streams_Event-Balance-and-Position-Update.md
DisneyandGitHub d6399b92aa Feat/support binance (#22)
* add docs

* Add Binance exchange support

- Updated the environment configuration to include Binance as a selectable exchange option.
- Enhanced the README documentation to reflect the addition of Binance.
- Implemented the Binance exchange adapter and integrated it into the existing exchange framework.
- Modified the basis arbitrage strategy to support Binance alongside existing exchanges.
- Added tests to ensure proper functionality and integration of Binance within the trading system.

* Enhance README with detailed Binance exchange configuration

- Added comprehensive instructions for setting up Binance as an exchange option.
- Included environment variable specifications for API keys, market types, and trading symbols.
- Provided examples for both perpetual and spot trading strategies.
- Clarified the use of WebSocket and REST for the Binance adapter.

* Enhance exchange support and testing framework

- Added a new test suite for exchange contracts to ensure consistency and functionality across supported exchanges.
- Refactored exchange ID handling to utilize a centralized list of supported exchanges, improving maintainability.
- Updated CLI argument parsing and help documentation to reflect the new exchange structure.
- Introduced utility functions for validating supported exchanges and their display names.
- Enhanced the BasisApp and strategy runner to leverage the new exchange validation logic.
- Added a new test command for running exchange-related tests.

* Refactor exchange contract tests and update CLI commands

- Removed the trailing supported exchanges set and simplified the logic for trailing stop support in the exchange contract tests.
- Updated the test command for exchange contracts to exclude unnecessary tests, streamlining the testing process.
- Enhanced test descriptions for clarity and improved understanding of the functionality being tested.
2026-02-27 11:37:44 +08:00

4.5 KiB
Raw Permalink Blame History

title, source, fetched_at
title source fetched_at
Event Balance And Position Update | Binance Open Platform https://developers.binance.com/docs/derivatives/usds-margined-futures/user-data-streams/Event-Balance-and-Position-Update 2026-01-27T05:28:32.911Z

Event: Balance and Position Update

Event Description

Event type is ACCOUNT_UPDATE.

  • When balance or position get updated, this event will be pushed.

    • ACCOUNT_UPDATE will be pushed only when update happens on user's account, including changes on balances, positions, or margin type.
    • Unfilled orders or cancelled orders will not make the event ACCOUNT_UPDATE pushed, since there's no change on positions.
    • "position" in ACCOUNT_UPDATE: Only symbols of changed positions will be pushed.
  • When "FUNDING FEE" changes to the user's balance, the event will be pushed with the brief message:

    • When "FUNDING FEE" occurs in a crossed position, ACCOUNT_UPDATE will be pushed with only the balance B(including the "FUNDING FEE" asset only), without any position P message.
    • When "FUNDING FEE" occurs in an isolated position, ACCOUNT_UPDATE will be pushed with only the balance B(including the "FUNDING FEE" asset only) and the relative position message P( including the isolated position on which the "FUNDING FEE" occurs only, without any other position message).
  • The field "m" represents the reason type for the event and may shows the following possible types:

    • 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
  • The field "bc" represents the balance change except for PnL and commission.

Event Name

ACCOUNT_UPDATE

Response Example

{  "e": "ACCOUNT_UPDATE",				// Event Type  "E": 1564745798939,            		// Event Time  "T": 1564745798938 ,           		// Transaction  "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          "bep":"0",                // breakeven price 		  "cr":"200",             	// (Pre-fee) Accumulated Realized          "up":"0",						// Unrealized PnL          "mt":"isolated",				// Margin Type          "iw":"0.00000000",			// Isolated Wallet (if isolated position)          "ps":"BOTH"					// Position Side        }        {        	"s":"BTCUSDT",        	"pa":"20",        	"ep":"6563.66500",        	"bep":"0",                // breakeven price        	"cr":"0",        	"up":"2850.21200",        	"mt":"isolated",        	"iw":"13200.70726908",        	"ps":"LONG"      	 },        {        	"s":"BTCUSDT",        	"pa":"-10",        	"ep":"6563.86000",        	"bep":"6563.6",          // breakeven price        	"cr":"-45.04000000",        	"up":"-1423.15600",        	"mt":"isolated",        	"iw":"6570.42511771",        	"ps":"SHORT"        }      ]    }}