Margin Requirements


When I place a futures limit post-only order in cross-margin-mode, I want to calculate in advance if my margin is enough to execute the order (since changing from market orders to limit orders I often get “Margin is insufficient.”). I tried to understand the calculations mainly from these pages:

Let’s start with my confusions:

  1. I understand that the main check is cost <= available_balance and this only applies to “orders that open a position” as Binance defines it:
  • Is there a way to stream (not REST API) the available_balance?
  • I found different calculations for the available_balance. Which is correct?
    Available Balance = Wallet Balance - Initial Margin + Unrealized PNL or
    Available for Order = max(0, crossWalletBalance + ∑cross Unrealized P&L - (∑cross initial margin + ∑isolated open order initial margin))
  • What is the formula for initial_margin (with leverage 1)?
    abs(position_size)*mark_price or abs(position_size)*limit_order_price
  1. The formula for cost Cost = Initial Margin + Open Loss seems not right in all possible scenarios:
  • scenario 1: I am holding 0 BTCUSDT and post a limit buy order of 1 BTCUSDT at 10’000USD. For this scenario the formula is right
  • scenario 2: I am holding -1 BTCUSDT with notional 10’000USD (mark price 10’000USD) and post a limit buy order 1.5 BTCUSDT at 10’000USD. According to the formula I need 15’000USD margin for the order. According to my logic, I have already allocated 10’000USD margin to the short position, close it and open a long position of 0.5 BTCUSDT worth 5’000USD. The margin needed would be 5’000USD. Where is my confusion?
  1. There is also the formula Margin Requirement = Max(Abs(Position Notional Value** + Bid Order Value***), Abs(Position Notional Value - Ask Order Value)) / Leverage
  • Let’s assume scenario 2 from above: According to this formula margin_requirement = max(abs(-10’000 + 1.5*10’000), abs(-10’000 - 0))/1 = 10’000USD. Again another value
  • What is correct?

I hope, somebody can clarify my confusions. Thanks!

  • Is there a way to stream (not REST API) the available_balance?

If you subscribe to your futures listenkey account, you’ll get “ACCOUNT_UPDATE” Event Type, every time the balance is updated. Pls refer to here.

For the rest of the questions regarding formulas. I’m sorry, but I’m not unfortunately I’m not an expert at Futures formulas, so I think the best here is to reach out to a Customer Support as they probably have encountered similar questions before.

Thanks for your reply. I will reach out to customer support.

Regarding your suggestion: The event I receive is

{'e': 'ACCOUNT_UPDATE', 'T': 1694770223277, 'E': 1694770223280, 'a': {'B': [{'a': 'USDT', 'wb': '10000', 'cw': '10000', 'bc': '0'}], 'P': [{'s': 'XLMUSDT', 'pa': '0', 'ep': '0', 'cr': '22.95613006', 'up': '0', 'mt': 'cross', 'iw': '0', 'ps': 'BOTH', 'ma': 'USDT', 'bep': '0'}], 'm': 'ORDER'}}

I get the wallet balance wb and cross wallet balance cw (whatever this balance is…). I cannot spot the available balance.