Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precision for "price" float value when placing orders #57

Closed
jdhurwitz opened this issue Dec 27, 2017 · 3 comments
Closed

Precision for "price" float value when placing orders #57

jdhurwitz opened this issue Dec 27, 2017 · 3 comments

Comments

@jdhurwitz
Copy link

What is the max precision for the "price" variable when placing an order, such as a limit order? I'm getting:

BinanceAPIException: APIError(code=-1111): Precision is over the maximum defined for this asset.

For the following float:
0.000614250470875

Is the trimming not handled by the API?

@sammchardy
Copy link
Owner

Hi @jdhurwitz no the API doesn't help you there at all.
Use the get_symbol_info function to get info about a particular symbol and then you can format your values for output using something like below

amount = 0.000614250470875
precision = 6
amount_str = "{:0.0{}f}".format(amount, precision)

@jessedhillon
Copy link

I'm just going to leave this here...

@lilanxin6
Copy link

The parameters ‘price’ and 'quantity' should be decimal, not float.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants