Any way to get the available balance from the websocket API?

The ACCOUNT_UPDATE event emits the wallet balance and cross wallet balance, but it does not emit the available balance. Two questions:

  1. Is there any way to get the available balance from the websocket endpoint?
  2. If I am exclusively using isolated margin, is it safe to use cross wallet balance as a proxy for the available balance?

If the balance is updated, it will be pushed in this event, otherwise please consider get them from restful API.

Thanks for the reply, Dino, but it doesn’t quite answer my question.

The ACCOUNT_UPDATE event emits the wallet balance and the cross wallet balance. These balances may or may not indicate how much is available to be withdrawn/traded. The REST endpoint has the additional fields availableBalance and maxWithdrawAmount.

What I want to know is whether the cross wallet balance can be used as a proxy for the availableBalance or maxWithdrawAmount when trading exclusively with isolated positions?

I should probably use this opportunity to request that you add the available/maxWithdrawAmount to the websocket event.

There is no point in sending transmitting the available balance with the ACCOUNT_UPDATE event, because the available balance is changing all the time, because of changing unrealized PNL.

However I have the same problem. I want to calculate available balance from data that I get from the stream.

I am doing this:

unrealized_pnl = abs(total_pos_amt) * mark_price - abs(total_pos_amt) * entry_price

available_balance = balance - ((abs(total_pos_amt) * entry_price) / leverage) + unrealized_pnl

What I get is in the range of the available balance that I get from a REST API request, or from the website. But it is never really correct. Why? I tried to use the latest price, the index price and the mark price for the calculation, same problem.

The unrealized_pnl calculation returns exactly the same values as the website and REST API, updated every 3 seconds. But my available_balance calculation is off. Why?

No. Available balance can’t be pushed from wss. Please retrieve it from REST

how can i do it?