Trying to make order at 1726 sats on a market with min price 1 sat, tickSize 1 sat and it rounds down to 1700 sats. Is this exchange's doing or API module?
Hi @ayy1337 the python-binance passes your values as is to the Binance API.
I don't know why it would be changing your price value. Can you give an example of how you're calling the create_order function.
Also if you haven't please read about the order filters in the official documentation https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#filters
`diff = price % pricefilters[market]
if diff >= .00000001:
price -= diff
...
order = binance.order_limit_buy(
symbol = market,
quantity = qty,
price = "{:8f}".format(price))`
Sorry idk how to format this correctly..

Pic related is code and such though
@ayy1337 you're most likely running into weird floating point rounding issues.
Does something like the following functions suit your purpose? You can pass the stepSize or tickSize values along with your computed quantity and price and have them formatted perfectly.
def step_size_to_precision(ss):
return ss.find('1') - 1
def format_value(val, step_size_str):
precision = step_size_to_precision(step_size_str)
return "{:0.0{}f}".format(val, precision)
step_size = "0.0010000"
quantity = 0.1231241
print(format_value(quantity, step_size))
step_size = "0.0000100"
quantity = 0.1231241
print(format_value(quantity, step_size))
But if it were that the printed value for price in the terminal wouldn't say 1726, since i used the same format string for both that and the order..
Had an issue to format small price coins. I used this code in order to fix it:
def step_size_to_precision(ss):
return ss.find('1') - 1
def format_value(val, step_size_str):
precision = step_size_to_precision(step_size_str)
if precision > 0:
return "{:0.0{}f}".format(val, precision)
return math.floor(int(val))
@sammchardy thanks for the code and @FIISHxMAN thanks for the mod.
It seems that there was a problem when a coin the step size was 1. FIISHxMAN mod fixed it.
Most helpful comment
@ayy1337 you're most likely running into weird floating point rounding issues.
Does something like the following functions suit your purpose? You can pass the
stepSizeortickSizevalues along with your computed quantity and price and have them formatted perfectly.