Fix and improve Tick size ROUND_DOWN logic

This commit is contained in:
Matthias
2023-08-30 08:21:02 +00:00
parent 3a6c00dbaf
commit bfc2c70b44
2 changed files with 8 additions and 5 deletions

View File

@@ -247,11 +247,14 @@ def test_amount_to_precision(amount, precision_mode, precision, expected,):
(2.34559, TICK_SIZE, 0.001, 2.346, ROUND_UP),
(2.9999, TICK_SIZE, 0.001, 3.000, ROUND_UP),
(2.9909, TICK_SIZE, 0.001, 2.991, ROUND_UP),
(2.9909, TICK_SIZE, 0.001, 2.990, ROUND_DOWN),
(2.9909, TICK_SIZE, 0.005, 2.995, ROUND_UP),
(2.9973, TICK_SIZE, 0.005, 3.0, ROUND_UP),
(2.9977, TICK_SIZE, 0.005, 3.0, ROUND_UP),
(234.43, TICK_SIZE, 0.5, 234.5, ROUND_UP),
(234.43, TICK_SIZE, 0.5, 234.0, ROUND_DOWN),
(234.53, TICK_SIZE, 0.5, 235.0, ROUND_UP),
(234.53, TICK_SIZE, 0.5, 234.5, ROUND_DOWN),
(0.891534, TICK_SIZE, 0.0001, 0.8916, ROUND_UP),
(64968.89, TICK_SIZE, 0.01, 64968.89, ROUND_UP),
(0.000000003483, TICK_SIZE, 1e-12, 0.000000003483, ROUND_UP),