Skip to content

Commit

Permalink
Add workaround to fix some tests
Browse files Browse the repository at this point in the history
Problem described here #575
Workaround is to use approx value for spread comparison accepting a
slight error.
  • Loading branch information
bitphage committed Mar 14, 2020
1 parent 31908d0 commit 00c9636
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ def test_maintain_strategy_no_manual_cp_empty_market(worker):
assert worker.market_center_price is None


@pytest.mark.xfail(reason='https://github.com/Codaone/DEXBot/issues/575')
@pytest.mark.parametrize('mode', MODES)
def test_maintain_strategy_basic(mode, worker, do_initial_allocation):
""" Check if intial orders placement is correct
"""
worker = do_initial_allocation(worker, mode)

# Check target spread is reached
assert worker.get_actual_spread() < worker.target_spread + worker.increment
assert worker.get_actual_spread() == pytest.approx(worker.target_spread, abs=(worker.increment / 2))

# Check number of orders
price = worker.center_price * math.sqrt(1 + worker.target_spread)
Expand Down Expand Up @@ -95,13 +94,12 @@ def test_maintain_strategy_one_sided(mode, base_worker, config_only_base, do_ini
assert worker.buy_orders[-1]['price'] < worker.lower_bound * (1 + worker.increment * 2)


@pytest.mark.xfail(reason='https://github.com/Codaone/DEXBot/issues/575')
def test_maintain_strategy_1sat(base_worker, config_1_sat, do_initial_allocation):
worker = base_worker(config_1_sat)
do_initial_allocation(worker, worker.mode)

# Check target spread is reached
assert worker.get_actual_spread() < worker.target_spread + worker.increment
assert worker.get_actual_spread() == pytest.approx(worker.target_spread, abs=(worker.increment / 2))

# Check number of orders
price = worker.center_price * math.sqrt(1 + worker.target_spread)
Expand Down

0 comments on commit 00c9636

Please sign in to comment.