Skip to content

Commit

Permalink
add freqtradebot execute_buy test in custom entry price case
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-CH committed Aug 4, 2021
1 parent bc3e6de commit 2cf781f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_freqtradebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,15 @@ def test_execute_buy(mocker, default_conf, fee, limit_buy_order, limit_buy_order
with pytest.raises(PricingError, match="Could not determine buy price."):
freqtrade.execute_buy(pair, stake_amount)

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


def test_execute_buy_confirm_error(mocker, default_conf, fee, limit_buy_order) -> None:
freqtrade = get_patched_freqtradebot(mocker, default_conf)
Expand Down

0 comments on commit 2cf781f

Please sign in to comment.