Improve test resiliance to small roundings

This commit is contained in:
Matthias 2022-10-20 19:57:56 +02:00
parent 107845afa8
commit f4814a7d59

View File

@ -420,7 +420,7 @@ def test_dca_order_adjust(default_conf_usdt, ticker_usdt, leverage, fee, mocker)
assert trade.open_order_id is None assert trade.open_order_id is None
# Open rate is not adjusted yet # Open rate is not adjusted yet
assert trade.open_rate == 1.99 assert trade.open_rate == 1.99
assert trade.stake_amount == 60 assert pytest.approx(trade.stake_amount) == 60
assert trade.stop_loss_pct == -0.1 assert trade.stop_loss_pct == -0.1
assert pytest.approx(trade.stop_loss) == 1.99 * (1 - 0.1 / leverage) assert pytest.approx(trade.stop_loss) == 1.99 * (1 - 0.1 / leverage)
assert pytest.approx(trade.initial_stop_loss) == 1.99 * (1 - 0.1 / leverage) assert pytest.approx(trade.initial_stop_loss) == 1.99 * (1 - 0.1 / leverage)
@ -446,7 +446,7 @@ def test_dca_order_adjust(default_conf_usdt, ticker_usdt, leverage, fee, mocker)
assert len(trade.orders) == 4 assert len(trade.orders) == 4
assert trade.open_order_id is not None assert trade.open_order_id is not None
assert trade.open_rate == 1.99 assert trade.open_rate == 1.99
assert trade.stake_amount == 60 assert pytest.approx(trade.stake_amount) == 60
assert trade.orders[-1].price == 1.95 assert trade.orders[-1].price == 1.95
assert pytest.approx(trade.orders[-1].cost) == 120 * leverage assert pytest.approx(trade.orders[-1].cost) == 120 * leverage