Linesofcode
Linesofcode

Reputation: 5891

Binance API - Account has insufficient balance for requested action

While trying to place an order, I'm receiving the following error:

Code: -2010 Account has insufficient balance for requested action

I'm requesting the POST endpoint https://api.binance.com/api/v3/order with the following parameters:

$params = 
[
    'symbol' => 'BTCUSDT',
    'side' => 'BUY',
    'type' => 'MARKET',
    'quoteOrderQty' => 375.00,
    'timestamp' => $timestamp,
];

And I just deposit 400$, which means I have enough funds to purchase 375$ worth of BTC.

What am I missing?

Upvotes: 3

Views: 24179

Answers (4)

Facundo Goiriz
Facundo Goiriz

Reputation: 51

It is because you are trying to buy 375.00 bitcoin.

quoteOrderQty must reference to the amount of symbol you want to buy.

if you want to buy btc for a percentage of your total money you should use this formula: (YourTotalMoney / CurrentPrice) * (Percentage / 100)

Example: I want to buy BTC using 50% of my USDT

Quantity = (getBalanceUSDT() / getCurrentPriceBTC()) * (50 / 100)

getBalanceUSDT() and getCurrentPriceBTC() are functions you will have to create

Now you can use Quantity for the quoteOrderQty param.

Upvotes: 0

CodeSlave
CodeSlave

Reputation: 457

The other option is to make sure you have enough BNB in your account to pay for the fees: https://dev.binance.vision/t/account-has-insufficient-balance-for-requested-action/2718/6

Upvotes: 0

galaxyraid
galaxyraid

Reputation: 31

I have had this before numerous times and this is why it happens.

Say you have 0.007821 worth of BTC in your Binance Wallet. And you are trying to place a SELL order. Now, if you end up rounding your quantity to say 4 decimal places, your code would try and SELL 0.0079 BTC. This is obviously more than what you have in your Exchange Wallet. This will cause the "Account has insufficient balance for requested action" error.

Solution: Simply match or reduce the amount in your code that you are trying to SELL to match the amount in your exchange Wallet. So, in this case, try and use the correct rounding decimal places or try to SELL 0.0078 worth of BTC.

Upvotes: 3

Mike Malyi
Mike Malyi

Reputation: 1101

I suggest you find your money and convert it to USDT if you want. Check this page using your browser https://binance.com/en/my/wallet/account/main and find what currency do you have now. Keep in mind that USD != USDT

Upvotes: 0

Related Questions