Skip to content

Commit

Permalink
fix test_execute_buy In case of custom entry price
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-CH committed Aug 16, 2021
1 parent 3ea4b2b commit faff405
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_freqtradebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,13 +905,14 @@ def test_execute_buy(mocker, default_conf, fee, limit_buy_order, limit_buy_order
freqtrade.execute_buy(pair, stake_amount)

# In case of custom entry price
mocker.patch('freqtrade.exchange.Exchange.get_rate', return_value=0.50)
limit_buy_order['status'] = 'open'
limit_buy_order['id'] = '5566'
freqtrade.strategy.custom_entry_price = lambda **kwargs: 0.77
freqtrade.strategy.custom_entry_price = lambda **kwargs: 0.508
assert freqtrade.execute_buy(pair, stake_amount)
trade = Trade.query.all()[6]
assert trade
assert trade.open_rate_requested == 0.77
assert trade.open_rate_requested == 0.508

# In case of custom entry price set to None
limit_buy_order['status'] = 'open'
Expand Down

0 comments on commit faff405

Please sign in to comment.