How to calculate BTC equal to how much USD?

Q: I have many coins, but wish to know how much are they valued in USD? or in BTC?

A: This endpoint GET /sapi/v1/accountSnapshot returns the summary of all coins values in BTC from totalAssetOfBtc.

The limitation of this endpoint:

  • it only returns account balance from one of “SPOT”, “MARGIN”, “FUTURES” for each request
  • it can’t not return current balance.

For BTC -> USD:

  • Getting BTCUSDT ticker price from Binance.com, and you will need to find out the USDT -> USD rate.
  • Getting BTCUSD ticker price from Binance.us.

If you wish to get latest total BTC value, the only way is to get balance from balance endpoint, and calculate it with ticker price (/api/v3/ticker/price) in client side.

If you use python, you can take the code of my repo:

  • …
  • see balance (free and locked)
  • calculate estimated balance in BTC and in USDT
  • …
1 Like

thank you