You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, placing an order for BTCUSDT with entry price $19500.38 will return an error. The correct price that Binance will accept is $19500.30, based on tickSize
One way I found to round the price is:
Math.round(price / tickSize) * tickSize
This works for every tickSize as long as it uses number "1" (just as I think is the case to all symbols in Binance). But it won't work if the number is different, like happens in Futures (in NASDAQ) where ticks could be "0.0005"
The text was updated successfully, but these errors were encountered:
Completely agree, would like to get utility functions like this added to the SDK, including adding unit test coverage to make sure all the different scenarios we see are covered and never accidentally broken. It's one of the painful aspects of trading on binance that could be made easier like this. I'll get to adding it eventually but I don't have bandwidth for this right now, but if anyone wants to contribute, I'd love to see some proposals/pull requests or even just code snippets here.
Don't know if this function already exists but I wasn't able to find it (if it already exists then close the issue)
It'd be very helpful to have a function that can round the price and help pass the Binance Filters
https://binance-docs.github.io/apidocs/futures/en/#filters
One of the filters is the PRICE_FILTER where Binance will return error when price is not aligned to tickSize
-4014 Price not increased by tick size
The information for the tickSize is in the informationr returned by /fapi/v1/exchangeInfo
For example, placing an order for BTCUSDT with entry price $19500.38 will return an error. The correct price that Binance will accept is $19500.30, based on tickSize
One way I found to round the price is:
Math.round(price / tickSize) * tickSize
This works for every tickSize as long as it uses number "1" (just as I think is the case to all symbols in Binance). But it won't work if the number is different, like happens in Futures (in NASDAQ) where ticks could be "0.0005"
The text was updated successfully, but these errors were encountered: