sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.89k stars 2.2k forks source link

Illegal characters found in a parameter (transfers/repayment precision?) #1213

Open sumade123 opened 2 years ago

sumade123 commented 2 years ago

In the past few days I have been receiving 1100 errors - APIError(code=-1100): Illegal characters found in a parameter.

This occurs for calls to transfer_spot_to_isolated_margin and repay_margin_loan.

I have not previously had issues with this, and wonder has there been a change to the Binance API specification? I suspect it may be related to precision in the 'amount' parameter. However, I can find no changes indicated in the Binance API change log. I can't find the required precision mentioned in the specification - what is the required precision for this parameter, and how can I best format it to ensure it meets expectations?

sumade123 commented 2 years ago

I added this code to hopefully avoid the issue. I think previously I transferred using the amount from get_max_margin_transfer, but now possibly after doing further checks on that value (within my own code), it results in a value with too much precision.

I am using the following to make it 8 decimal places, but if anyone knows whether this will work, or if the issue is likely to be something else, and whether all coins are 8 decimal places for transfers and loan/repayment, it would be great if you could comment.

from decimal import Decimal,ROUND_DOWN step=str(0.00000001) Decimal(value).quantize(Decimal(step), rounding=ROUND_DOWN)