python-binance
python-binance copied to clipboard
chore: update round_step_size to use quantize
Ran tests with old code and new code and gave the same result. There was one exception where old code if step size was 1.0 would round like a step size of 1 while current implementations step size 1.0 rounds like 0.1
Fix #1496
coverage: 67.986%. remained the same when pulling 2e27c2af313a9f7588b8bba37c01ce5fb0072801 on pcriadoperez:round-step-size into 10f398688b58fed8fc0e28e9e0c36d0cb01fdd24 on sammchardy:master.
Please note that accepting float might lead to undesired results:
round_step_size(0.09999999999999999, 0.1)
Out[11]: 0.0
round_step_size(0.09999999999999999999, 0.1)
Out[12]: 0.1
If the type of the argument is float, add an eps (machine precision) prior to rounding.