Available Balance and Buying/Selling Power

In this section, we will conduct a detailed analysis of the Available Balance formula, explain its components, and demonstrate the calculation logic with practical examples. Available Balance is an estimate of the liquid capital in your account that is available for withdrawal or for opening new positions unrelated to existing ones.

Conceptual Basis: Weighted Account Balance Evaluation

The system calculates this metric by conducting a comprehensive assessment of all active limit orders and positions. This approach ensures that the account always has sufficient collateral, regardless of the order in which orders are executed. This means the system proactively reserves margin for those orders that could increase risk, thereby ensuring the financial stability of the account. In other words, this metric represents the amount of funds not actually locked in positions or orders and is calculated using a weighted approach to risk management.


The Available Balance Formula

The formula for calculating Available Balance (ab) is as follows:

ab=max(0,funding+(upnl_negative)(max(im+direct(ufVolumeleverage),imopos(ufVolumeleverage)))pending_withdrawals)ab = \max(0, \text{funding} + \sum (\text{upnl\_negative}) - \sum(\max(\text{im} + \text{direct}(\frac{\text{ufVolume}}{\text{leverage}}), |\text{im} - \text{opos}(\frac{\text{ufVolume}}{\text{leverage}})|)) - \text{pending\_withdrawals})

Note! The max(0,...) wrapper ensures that the available balance value cannot be negative. If total liabilities exceed assets, the AB will be zero.


Detailed Parameter Breakdown

Each component of the formula plays an important role in determining the final value.

Component
Description
Example & Explanation

funding

The total balance of your wallet. These are your own, deposited funds.

If you deposited 1000 USDT into your account, funding = 1000.

sum(upnl_negative)

The sum of only the negative unrealized PnL across all open positions.

You have two positions: one with a profit of +200 USDT, and another with a loss of -300 USDT. Only the -300 USDT value will be included in the formula.

sum(max(...))

The total reserved margin for all existing positions and all open orders. This is the "heart" of the formula, calculating total liabilities.

This value is calculated for each position (with its orders) and then summed across the entire portfolio.

im

The initial margin already reserved for an existing open position.

For a 1 BTC position with 10x leverage, the IM is 0.1 BTC.

direct(ufVolume / leverage)

The additional margin required for unfilled orders that increase the size of an existing position (e.g., a limit order to buy more BTC).

If you have a limit order to buy 0.5 BTC with 10x leverage, this component will reserve an additional 0.05 BTC.

opos(ufVolume / leverage)

The margin that will be released upon the execution of unfilled orders that reduce the position (e.g., a take-profit order).

If you have a take-profit order to sell 0.5 BTC from your 1 BTC position, this component will show that 0.05 BTC of margin will be released.

max(A,B)

Where A = im + direct(...) and B = abs(im - opos(...)). The system chooses the larger of these two values, simulating a worst-case scenario.

The system assesses which scenario would require more collateral: the execution of orders that increase the position or the execution of orders that decrease it.

pending_withdrawals

The amount of funds that you have requested for withdrawal but have not yet been sent.

If you create a withdrawal request for 500 USDT, this amount is immediately subtracted from the available balance.

The underlying logic of this formula is conservative. For instance, only upnl_negative is considered, ignoring positive unrealized gains, based on fundamental risk management principles. Unrealized profits are "on paper" and can vanish anytime before position closure. Using them to increase the Available Balance would equate to spending funds not yet realized, thus protecting traders from excessive risk and overestimating actual withdrawable funds.

The central element is the function: max(im + direct(...), abs(im - opos(...))), which conservatively estimates which set of orders - opening or closing - creates a greater margin burden. The exchange pre-emptively reserves margin for the scenario that requires more collateral, thereby protecting the account from an unexpected margin deficit upon the partial or full execution of orders.


Practical Examples of Available Balance Calculation

Example 1: A simple account with no activity

  • Conditions: funding = 1000 USDT. No positions, no open orders, no withdrawal requests.

  • Calculation: ab = 1000 USDT. All other components are zero.

Example 2: An account with a losing position

  • Conditions: funding = 1000 USDT. One open position for which im = 100 USDT. The current unrealized loss upnl_negative = -50 USDT.

  • Calculation: ab = 1000 + (-50) - 100 = 850 USDT.

Example 3: A complex scenario with a position and orders

  • Conditions:

    • funding = 2000 USDT.

    • A Long BTC position is open, requiring im = 200 USDT.

    • Current upnl_negative = -50 USDT.

    • A limit order is placed to increase the position, requiring direct(...) = 50 USDT.

    • A take-profit order is placed, which upon execution will release opos(...) = 80 USDT.

  • Calculation:

    1. First, the system evaluates two scenarios for margin requirements.

      • Scenario A (execution of the increasing order): im + direct(...) = 200 + 50 = 250 USDT.

      • Scenario B (execution of the decreasing order): abs(im - opos(...)) = abs(200 - 80) = 120 USDT.

    2. The system then chooses the most margin-intensive scenario: max(250, 120) = 250 USDT.

    3. Now, the ab is calculated: ab = 2000 + (-50) - 250 = 1700 USDT.

Conclusion: Despite having 2000 USDT in the account, only 1700 USDT is available for withdrawal or for opening new positions unrelated to BTC. This is because the system has conservatively reserved 250 USDT for the riskiest possible outcome involving the open orders.

Last updated