Implicit conversion of numbers to strings results in invalid requests
Opened this issue · 0 comments
gemmell commented
If you attempt to buy something with a very low value using BTC, it will fail with a message like "Illegal characters found in parameter 'price'; legal range is '^([0-9]{1,20})(.[0-9]{1,20})?$'". This is because the placeOrder function takes a number which gets implicitly casted to a string. However javascript can represent the number like "1.1e-8" which is not in the valid set of numbers described by binance. You can probably use something like toFixed to force it to a specific representation (preferably using the information about how many decimals the particular pair uses, but I guess toFixed(20) would also adhere to the API).