Binance Blog의 "What Is the Available Balance, Margin Balance, and Total Balance on Binance Futures?" 포스트(2023-05-22) 정리
The futures wallet on Binance Futures displays four different types of balances: wallet balance, available balance, margin balance, and total balance. Each balance serves a specific purpose and reflects the user's available funds, profits, and losses.
- 바이낸스는 4가지 타입의 balance를 보여줌. 각 balance는 특정 용도로 사용됨
- wallet balance
- available balance
- margin balance
- total balance
- Wallet balance
- User의 Futures wallet에 보관된 암호화폐의 총 가치를 나타냄
- Wallet Balance = Total Net Transfer + Total Realized Profit + Total Net Funding Fee - Total Commission
- Total Net Transfer
- Total Realized Profit
- Total Net Funding Fee
- Total commission
- 새 포지션을 개설(Opening new positions)해도 User의 wallet balance에는 영향을 미치지 않음
- 실현된 손익(Reailzed PNL)만을 포함하고 open position들의 미실현 손익(unreailzed PNL)은 포함하지 않음
the futures wallet balance only includes funds that are currently not being used as collateral.- 즉, 선물의 wallet balance 에는 현재 담보(collateral)로 사용되지 않는 자금만 포함
- Available balance
- User가 새로운 포지션을 개설(open new positions)하거나 기존 포지션의 증거금 요건을 충족(meet margin requirements)하기 위해 접근할 수 있는 자금
- Available Balance = Wallet Balance - Initial Margin + Unrealized PNL
- Unrealized PNL은 개설된 포지션의 현재 PNL
- Available Balance에 큰 영향
- Unrealized PNL은 개설된 포지션의 현재 PNL
- Margin balance
- Margin Balance = Wallet Balance + Unrealized PNL
------------------------------------------------------------------------------------------------
Available Balance = Wallet Balance - Initial Margin + Unrealized PNL
Margin Balance = Wallet Balance + Unrealized PNL
------------------------------------------------------------------------------------------------
위의 2개의 식을 서로 빼면
Available Balance - Margin Balance = -Initial Margin
Margin Balance - Available Balance = Initial Margin
------------------------------------------------------------------------------------------------
다르게 표현하면
Margin Balance = Available + Initial Margin
Available Balance = Margin Balance - Initial Margin
------------------------------------------------------------------------------------------------
Available Balance = Wallet Balance - Initial Margin + Unrealized PNL
Available Balance = Margin Balance - Initial Margin
- Total balance
The total balance comprises the sum of your wallet balance and margin balance, including unrealized profit and loss (PNL).
- 이 말은 your wallet balance and margin balance, including unrealized PNL.
- 위에서 Margin Balance = Wallet Balance + Unrealized PNL 라고 했으니
- Total balance = Wallet Balance + Margin Balance 라는건가??
- 아니 근ㄷㅔ
- Margin Balance에는 이미 Wallet Balance 이게 포함되어 있는데.... 그럼
- Total balance = (2* Wallet Balance) + Unrealized PNL ???????????
- ???????????????일단 total balance 는 패쓰..
-----------------------------
실질적으로 사용하는 부분 확인
api docs에서 선물 지갑쪽을 살펴보면
total balance 는 없고
totalWalletBalance
totalMarginBalance
totalCrossWalletBalance
availableBalance
이렇게 4가지가 있음
totalCrossWalletBalance는 사실상 available Balance 이지만 아직 체결되지 않은 position open order이 존재할때
그 amount 만큼 차이가 남
즉 totalCrossWalletBalance = available Balance + 미체결 오더의 amount(해당 심볼의 initial_margin)
total balance는 빼고 생각해도 될듯함
isolated로 한다고 가정하고 정리해보면 아래 그림처럼

2024-03-29 추가
확인을 위해 최소단위로 포지션 오픈하여 확인해본 결과.. 뭔가 이상함
바이낸스 홈페이지(What Is the Available Balance, Margin Balance, and Total Balance on Binance Futures)에서 작성된 글에는 분명 " Available Balance = Wallet Balance - Initial Margin + Unrealized PNL" 이렇게 명시되어있지만, api docs의 availableBalance 는 Unrealized PNL이 반영이 안됨. 일단 실시간으로 Unrealized PNL은 소수점단위로 변화하지만 availableBalance는 포지션 오픈하거나 오픈 주문을 낼때가 아니면 값이 바뀌지 않음.
뭐지? 확실한건 위의 그림은 다시그려야 할 것 같음.

BTCUSDT , ETHUSDT 각각의 Entry Price는 70,400.00 , 3,550.00 이고 각각 최소 수량은 0.001, 이고 최소 명목가치는 100USDT, 20USDT 이므로
진입 notional_value는 각각 140.8 , 21.3 이였지만, Margin 값들은 각각 140.74 , 21.29
진입 시 발생한 comission (Trading_Fee), 홀딩하다 빠져나간 Funding_Fee는 아래와 같음

BTCUSDT comission -0.02816000 funding fee -0.03556374
ETHUSDT comission -0.00426000 funding fee -0.00641001
notional_value에서 각각을 빼면
BTCUSDT
- comission만 차감 140.7718400
- funding fee만 차감 140.76443626
- 둘다 차감 140.7362762600
ETHUSDT
- comission만 차감 21.2957400
- funding fee만 차감 21.29358999
- 둘다 차감 21.2893299900
BTCUSDT 의 Margin이 140.74 인거보면 둘다 차감후 소수점 3번째 자리에서 반올림 하는것 같음
결과적으로

이렇게 되는것 같음
- The Maintenance Margin(유지 증거금)
- 선물 트레이더가 레버리지 포지션을 유지하기 위해 계좌에 유지해야 하는 최소 담보 금액(the minimum amount of collateral)을 의미
- Maintenance Margin = Notional Position Value * Maintenance Margin Rate - Maintenance Amount
- Initial Margin = Notional Position Value / Leverage Level
- Leverage & Margin table에서 Maintenance Margin Rate 확인

- 100,000 USDT 를 초기 증거금(Initial Margin)으로 할 경우
- Initial Margin = Notional Position Value / Leverage Level
- 100,000USDT/ 1 = 100,000USDT
- 유지 증거금(Maintenance Margin)은
- Maintenance Margin = Notional Position Value * Maintenance Margin Rate - Maintenance Amount
- 100,000USDT * 0.0005 - 50 = 450 USDT
- 담보(collateral)의가치가 유지 증거금(Maintenance Margin) 보다 떨어지면 Auto-deleveraging?? 이라기 보다 본문에는 이렇게 적혀 있음
- It is important to note that the Maintenance Margin will directly affect the liquidation price. To avoid auto-deleveraging, it is highly recommended to close your positions before the collateral falls below the Maintenance Margin.
- "유지 증거금은 liquidation price에 직접적인 영향을 줌. auto-deleveraging 을 피하기 위해서는 담보(collateral)의 가치가 Maintenance Margin 보다 떨어지기 전에 포지션을 종료하는걸 추천함" 라고 명시되어있음
- ADL(Auto-deleveraging)은 간단하게 말하자면(관련 포스팅은 나중에...) 유지증거금과는 상관없이 자동청산되는걸 의미. 거래소가 수익자들에게 지급할 돈이 없을때를 대비해서(보험기금조차 고갈난 상황) 포지션을 open한 유저들을 강제로 정리해서 손해난 사람들에게서 얻은 돈을 수익자들에게 주는것
- 아직까지 모든 비트코인 선물거래소에서 보험기금이 고갈나서 ADL이 발생한적이 없다고함
위에서 "wallet balance는 현재 담보(collateral)로 사용되지 않는 자금만 포함" 언급
그리고
Liquidation is triggered when Margin Balance < Maintenance Margin.
담보(collateral)의 가치가 유지 증거금(Maintenance Margin)보다 떨어지면 liqudidation 발생
우선, 강화학습용으로 balance를 크게 3개로 구분해서
wallet balance
available balance <- trading_fee, funding_fee 나가는 잔고(wallet address 구분하는건 나중에..)
margin balance <- liquidation 의 기준이 되는 잔고
로 사용하면 될듯함
로직을 정리해보면
Wallet_balance = Total Net Transfer + Total Realized Profit + Total Net Funding Fee - Total Commission
이지만, 이건 바이낸스 현물거래지갑, 펀딩지갑 등에서 오고가는 부분을 위해 이렇게 설정된거니, 강화학습에 맞게 수정
total_net_transfer초기 자금(초기 증거금 X)initial_balance
total_realized profit이건 왜... total_realized profit_and_loss 가 아닌것일까..realized PNL 이라고 치고action notional_position_value, trading_fee 값 사용해서 산출self.close_notional_position_value = self.notional_position_valueprofit_value = close_notional_position_value - open_notional_position_valuetotal_fee =action == close
total_net_funding_feeaction, notional_position_value, funding_rate 값 사용해서 산출self.open_notional_position_value = self.notional_position_valueaction == holdwallet_balance 에서 차감
total_commissiontrading_fee 로 명명notional_position_value, trading_fee 값 사용해서 산출wallet_balance 에서 차감
wallet_balance = initial_balance +
+ total_realized profit + total_net_funding fee_total commission
initial_margin 은 notional_position_value 에서 leverage_level을 나눈값
leverage_and_margintable 에서 notional_value를 기준으로 max_leverage와 maintenance_margin_rate, maintenance_amount를 가져옴
maintenance_margin은 notional_position_value * maintenance_margin_rate - maintenance_amount
여기서 나오는 값은
--> initial_margin, maintenance_margin
position을 open했을때 업데이트 해야하는 변수
available_balancenotional_position_value * trading_fee 만큼 차감
margin_balance
Leverage and Margin of USDⓈ-M Futures
Leverage and Margin of USDⓈ-M Futures | Binance
Binance uses a sophisticated risk control system and liquidation model to support high leverage trading by adopting the Maintenance Margin model. For the latest updates, please refer to the Leverage & Margin page.What are maximum position, maximum leverage
www.binance.com
Leverage & Margin of Futures Contracts | Binance Futures
Please be aware that in the event of extreme price movements or deviation from the price index, Binance will undertake additional protective measures, including but not limited to: 1. Adjust maximum leverage value 2. Adjust position bracket in each tier 3.
www.binance.com