diff --git a/freqtrade/tests/test_main.py b/freqtrade/tests/test_main.py index 7e03b7512..702a5d16c 100644 --- a/freqtrade/tests/test_main.py +++ b/freqtrade/tests/test_main.py @@ -133,6 +133,21 @@ def test_create_trade(default_conf, ticker, limit_buy_order, mocker): assert whitelist == default_conf['exchange']['pair_whitelist'] +def test_create_trade_minimal_amount(default_conf, ticker, mocker): + mocker.patch.dict('freqtrade.main._CONF', default_conf) + mocker.patch.multiple('freqtrade.rpc', init=MagicMock(), send_msg=MagicMock()) + mocker.patch('freqtrade.main.get_signal', side_effect=lambda s, t: True) + buy_mock = mocker.patch('freqtrade.main.exchange.buy', MagicMock(return_value='mocked_limit_buy')) + mocker.patch.multiple('freqtrade.main.exchange', + validate_pairs=MagicMock(), + get_ticker=ticker) + init(default_conf, create_engine('sqlite://')) + min_stake_amount = 0.0005 + create_trade(min_stake_amount) + rate, amount = buy_mock.call_args[0][1], buy_mock.call_args[0][2] + assert rate * amount >= min_stake_amount + + def test_create_trade_no_stake_amount(default_conf, ticker, mocker): mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch('freqtrade.main.get_signal', side_effect=lambda s, t: True)