Python-binance: APIError(code=-2010): Account has insufficient balance for requested action.

Created on 3 Jan 2018  路  3Comments  路  Source: sammchardy/python-binance

Hi,

Thank's for your great project. I am using the demo account. My api and secret key is provided by someone else. When I use the simple code in the demo, I get the following error.

Traceback (most recent call last):
  File "C:\Users\UserName\Desktop\python\bintest.py", line 16, in <module>
    quantity=100)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python36-32\lib\site-packages\binance\client.py", line 858, in create_order
    return self._post('order', True, data=params)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python36-32\lib\site-packages\binance\client.py", line 189, in _post
    return self._request_api('post', path, signed, version, **kwargs)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python36-32\lib\site-packages\binance\client.py", line 160, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python36-32\lib\site-packages\binance\client.py", line 155, in _request
    return self._handle_response(response)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python36-32\lib\site-packages\binance\client.py", line 179, in _handle_response
    raise BinanceAPIException(response)
binance.exceptions.BinanceAPIException: APIError(code=-2010): Account has insufficient balance for requested action.


Thank's :)

Most helpful comment

Hi Hujjat,
I haven't used this project but I had a similar error message with another python exchange wrapper. The problem was in the end that I was reading my funds from the exchange and save it in a variable to use it later in a buy operation. But through data type conversion I got more decimal points than supportet. I had to write a rounding function to get it back to the maximum digits allowed (in my case Satoshi units "one hundred millionth of a single bitcoin") and then it worked again. I never had insufficient funds but my request wasn't supported.
Maybe this will help you.

Cheers
Philip

All 3 comments

Hi Hujjat,
I haven't used this project but I had a similar error message with another python exchange wrapper. The problem was in the end that I was reading my funds from the exchange and save it in a variable to use it later in a buy operation. But through data type conversion I got more decimal points than supportet. I had to write a rounding function to get it back to the maximum digits allowed (in my case Satoshi units "one hundred millionth of a single bitcoin") and then it worked again. I never had insufficient funds but my request wasn't supported.
Maybe this will help you.

Cheers
Philip

Hi @Hujjat the example code is just that, an example of how you may use the wrapper.

If you look at the create order example you have copied it's attempting to buy 100 BNB with BTC. You don't have enough BTC on your account to purchase this much so you receive the "Account has insufficient balance for requested action" error from Binance.

What I will do is change the example to create_test_order function so no one else copies and pastes and makes the same mistake.

@sammchardy @philschw thanks. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

homeless-computing picture homeless-computing  路  4Comments

fj317 picture fj317  路  6Comments

terenceljz picture terenceljz  路  3Comments

scalpounet picture scalpounet  路  6Comments

bilgecetin picture bilgecetin  路  6Comments