Contents and sources 4 sections
Key points
- quantize adjusts decimal places; it does not guarantee a multiple of an arbitrary increment.
- Rounding up or down can breach the original price or quantity constraint.
- An aligned value still needs the applicable quantity, notional and budget checks.
Two decimal places are not enough
Set a price of 1.23 and a minimum increment of 0.05. Both have two decimal places, but 1.23 is not a multiple of 0.05. In this synthetic test, passing the two values to Decimal.quantize still returned 1.23. Its remainder after division by 0.05 was 0.03.
quantize controls decimal places. Python documents it as matching the exponent of the second value; Binance Spot PRICE_FILTER checks that a price is a multiple of tickSize. Passing the display-format check does not establish that a price meets the trading rule.[1][2]
Adding zeros does not fix the mismatch
Writing the increment as 0.05000000 instead of 0.05 made quantize return 1.23000000. The extra decimal places left a remainder of 0.03000000. For these inputs, dividing by the increment, rounding down to an integer and multiplying back produced 1.20. Rounding up produced 1.25. The already aligned input 1.25 stayed at 1.25 in both directions.
To reproduce this with the Python standard library, import the names with from decimal import Decimal as D, ROUND_FLOOR, ROUND_CEILING. Set x = D('1.23') and step = D('0.05'). Compare x.quantize(step) with (x / step).to_integral_value(rounding=ROUND_FLOOR) * step, then replace ROUND_FLOOR with ROUND_CEILING. Construct the price and increment directly from their original decimal strings, without first converting them to float.[1]
Rounding changes the order
If 1.23 is the highest limit price a buyer will accept, raising it to 1.25 breaches that ceiling. If it is the lowest limit price a seller will accept, lowering it to 1.20 breaches that floor. Choose a direction from the constraints of the particular order, rather than assigning one direction to every buy or sell. Alignment does not guarantee a fill.
Quantity creates the same problem. With a synthetic quantity of 0.0049 and an increment of 0.005, rounding down produced 0.000; rounding up produced 0.005. One leaves no positive quantity to submit, while the other exceeds the original quantity. Decide whether to cancel using the original quantity and budget constraints. Do not silently increase an order just to pass a format check.
An aligned order still needs other checks
Binance LOT_SIZE also sets quantity bounds, and notional value has separate filters. In another synthetic example, a price of 1.20 times a quantity of 4 gives 4.80. With a minimum notional of 5, it still fails. Read the applicable rules for the current symbol and order type; none of these example thresholds is a live market setting.[2]
These four small synthetic cases ran on 2026-11-07 with Python 3.14.6 and Decimal precision 28. No trading account was connected and no order was submitted. Returns, fees, slippage and fill rates were not measured. The divisions used here are exact at this precision; longer values need separate precision and boundary tests. Production validation must also reject non-finite values, handle zeros or disabled rules, and recheck price, quantity and budget constraints after adjustment. This article was researched and written with AI assistance; the cover is an AI-generated conceptual illustration.
Sources & further reading
(2)
When checking a claim, compare the source date, measurement period and conditions. Some linked pages change over time.
For information and education, not investment advice. Crypto assets are volatile. Verify independently.


