question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Binance create_market_sell_order: Illegal characters found in parameter 'quantity'

See original GitHub issue

Here is a simple example of this problem. a is created as a Binance exchange object and the markets are already fetched. However,

>>> a.create_market_sell_order('BTC/USDT', 0.000096)
Traceback (most recent call last):
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/ccxt/base/exchange.py", line 346, in fetch
    response.raise_for_status()
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.binance.com/api/v3/order

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/ccxt/base/exchange.py", line 1010, in create_market_sell_order
    return self.create_order(symbol, 'market', 'sell', amount, None, params)
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/ccxt/binance.py", line 545, in create_order
    response = self.privatePostOrder(self.extend(order, params))
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/ccxt/base/exchange.py", line 296, in request
    return self.fetch2(path, api, method, params, headers, body)
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/ccxt/base/exchange.py", line 293, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/ccxt/base/exchange.py", line 358, in fetch
    self.handle_errors(response.status_code, response.reason, url, method, None, self.last_http_response)
  File "/Users/Allen_Frostline/anaconda3/lib/python3.6/site-packages/ccxt/binance.py", line 707, in handle_errors
    raise ExchangeError(self.id + ' ' + self.json(response))
ccxt.base.errors.ExchangeError: binance {"code":-1100,"msg":"Illegal characters found in parameter 'quantity'; legal range is '^([0-9]{1,20})(\\.[0-9]{1,20})?$'."}
>>> 

Can anybody explain or solve this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
dexhuntercommented, Apr 28, 2018

@akaniklaus You can use '{:.8f}'.format(float(1e-8)) to get 0.00000001

1reaction
ghostcommented, Jul 5, 2020

this error also appears if since= is a float, ensure its an int() or use exchange.milliseconds(). fin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Illegal characters found in parameter 'price' Python Binance
As the error stated the order prices need to be given as a string not as a number. It also showed you the...
Read more >
Binance US: Illegal characters found in a parameter.
Hello,. I'm trying to fetch some GET routes with Binance US API but for a huge quantity of endpoint I only have the...
Read more >
'Illegal characters found in parameter 'quantity'; legal range is...'
"""Internal helper for handling API responses from the Binance server. Raises the appropriate exceptions when necessary; otherwise, returns the.
Read more >
Exchanges — ccxt 2.4.71 documentation
The ccxt library is a collection of available crypto exchanges or exchange classes. Each class implements the public and private API for a...
Read more >
Issue 42303: I found a bug while checking string with find()
USED THE PYTHON-BINANCE MODULE FOR THIS ... range is") = 38 E.message = "Illegal characters found in parameter 'quantity'; legal range is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found