From 7727f2cc8ff93e458f8e46378c4147a8c2a2b34c Mon Sep 17 00:00:00 2001 From: gcarq Date: Wed, 22 Nov 2017 21:02:36 +0100 Subject: [PATCH] implement test --- freqtrade/tests/test_main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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)