MultiversX Tracker is Live!

Binance Futures API. How to calculate market order quantity?

Binance

Cryptocoins Exchanges / Binance 222 Views

Binance Spot API has a parameter quoteOrderQty which will allow you to say how much you want to spend for an order, like you want to buy $50 worth, you just need to do quoteOrderQty=5

However, Futures API doesn't have this calculation and you need to find how much is the Quantity yourself - docs

Does anyone know how can I calculate the quantity of the order?
I am trying to do it as:

js:

const orderSize = (((percentageOfFunds / 100) * availableFunds) / price) * leverage;

However, I am getting { code: -2019, msg: 'Margin is insufficient.' }

I am pretty sure something is bad in that calculation, probably missing some fee calculation in there because when I do the same request in the binance UI and watch the network tab, I get the quantity being 25.08 and mine is 25.255 at the same time.

Thank you!

submitted by /u/kwietog
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments