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!
[link] [comments]
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