|
|
|
@@ -26,8 +26,8 @@ from freqtrade.optimize.backtest_caching import get_strategy_run_id
|
|
|
|
|
from freqtrade.optimize.backtesting import Backtesting
|
|
|
|
|
from freqtrade.persistence import LocalTrade, Trade
|
|
|
|
|
from freqtrade.resolvers import StrategyResolver
|
|
|
|
|
from tests.conftest import (CURRENT_TEST_STRATEGY, get_args, log_has, log_has_re, patch_exchange,
|
|
|
|
|
patched_configuration_load_config_file)
|
|
|
|
|
from tests.conftest import (CURRENT_TEST_STRATEGY, EXMS, get_args, log_has, log_has_re,
|
|
|
|
|
patch_exchange, patched_configuration_load_config_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ORDER_TYPES = [
|
|
|
|
@@ -245,7 +245,7 @@ def test_setup_optimize_configuration_stake_amount(mocker, default_conf, caplog)
|
|
|
|
|
|
|
|
|
|
def test_start(mocker, fee, default_conf, caplog) -> None:
|
|
|
|
|
start_mock = MagicMock()
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
mocker.patch('freqtrade.optimize.backtesting.Backtesting.start', start_mock)
|
|
|
|
|
patched_configuration_load_config_file(mocker, default_conf)
|
|
|
|
@@ -269,7 +269,7 @@ def test_backtesting_init(mocker, default_conf, order_types) -> None:
|
|
|
|
|
"""
|
|
|
|
|
default_conf["order_types"] = order_types
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
get_fee = mocker.patch('freqtrade.exchange.Exchange.get_fee', MagicMock(return_value=0.5))
|
|
|
|
|
get_fee = mocker.patch(f'{EXMS}.get_fee', MagicMock(return_value=0.5))
|
|
|
|
|
backtesting = Backtesting(default_conf)
|
|
|
|
|
backtesting._set_strategy(backtesting.strategylist[0])
|
|
|
|
|
assert backtesting.config == default_conf
|
|
|
|
@@ -290,7 +290,7 @@ def test_backtesting_init_no_timeframe(mocker, default_conf, caplog) -> None:
|
|
|
|
|
default_conf['strategy_list'] = [CURRENT_TEST_STRATEGY,
|
|
|
|
|
'HyperoptableStrategy']
|
|
|
|
|
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', MagicMock(return_value=0.5))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', MagicMock(return_value=0.5))
|
|
|
|
|
with pytest.raises(OperationalException,
|
|
|
|
|
match=r"Timeframe needs to be set in either configuration"):
|
|
|
|
|
Backtesting(default_conf)
|
|
|
|
@@ -300,7 +300,7 @@ def test_data_with_fee(default_conf, mocker) -> None:
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
default_conf['fee'] = 0.1234
|
|
|
|
|
|
|
|
|
|
fee_mock = mocker.patch('freqtrade.exchange.Exchange.get_fee', MagicMock(return_value=0.5))
|
|
|
|
|
fee_mock = mocker.patch(f'{EXMS}.get_fee', MagicMock(return_value=0.5))
|
|
|
|
|
backtesting = Backtesting(default_conf)
|
|
|
|
|
backtesting._set_strategy(backtesting.strategylist[0])
|
|
|
|
|
assert backtesting.fee == 0.1234
|
|
|
|
@@ -404,7 +404,7 @@ def test_backtesting_start_no_data(default_conf, mocker, caplog, testdatadir) ->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) -> None:
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
|
|
|
|
|
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
|
|
|
|
mocker.patch('freqtrade.data.history.history_utils.load_pair_history',
|
|
|
|
|
MagicMock(return_value=pd.DataFrame()))
|
|
|
|
|
mocker.patch('freqtrade.data.history.get_timerange', get_timerange)
|
|
|
|
@@ -436,9 +436,9 @@ def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) ->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, tickers) -> None:
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_tickers', tickers)
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.price_to_precision', lambda s, x, y: y)
|
|
|
|
|
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_tickers', tickers)
|
|
|
|
|
mocker.patch(f'{EXMS}.price_to_precision', lambda s, x, y: y)
|
|
|
|
|
mocker.patch('freqtrade.data.history.get_timerange', get_timerange)
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
mocker.patch('freqtrade.optimize.backtesting.Backtesting.backtest')
|
|
|
|
@@ -474,9 +474,9 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti
|
|
|
|
|
|
|
|
|
|
def test_backtest__enter_trade(default_conf, fee, mocker) -> None:
|
|
|
|
|
default_conf['use_exit_signal'] = False
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f'{EXMS}.get_min_pair_stake_amount', return_value=0.00001)
|
|
|
|
|
mocker.patch(f'{EXMS}.get_max_pair_stake_amount', return_value=float('inf'))
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
default_conf['stake_amount'] = 'unlimited'
|
|
|
|
|
default_conf['max_open_trades'] = 2
|
|
|
|
@@ -525,7 +525,7 @@ def test_backtest__enter_trade(default_conf, fee, mocker) -> None:
|
|
|
|
|
assert trade.stake_amount == 495
|
|
|
|
|
assert trade.is_short is True
|
|
|
|
|
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=300.0)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=300.0)
|
|
|
|
|
trade = backtesting._enter_trade(pair, row=row, direction='long')
|
|
|
|
|
assert trade
|
|
|
|
|
assert trade.stake_amount == 300.0
|
|
|
|
@@ -533,10 +533,10 @@ def test_backtest__enter_trade(default_conf, fee, mocker) -> None:
|
|
|
|
|
|
|
|
|
|
def test_backtest__enter_trade_futures(default_conf_usdt, fee, mocker) -> None:
|
|
|
|
|
default_conf_usdt['use_exit_signal'] = False
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_leverage", return_value=100)
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_leverage", return_value=100)
|
|
|
|
|
mocker.patch("freqtrade.optimize.backtesting.price_to_precision", lambda p, *args: p)
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
default_conf_usdt['stake_amount'] = 300
|
|
|
|
@@ -564,7 +564,7 @@ def test_backtest__enter_trade_futures(default_conf_usdt, fee, mocker) -> None:
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
backtesting.strategy.leverage = MagicMock(return_value=5.0)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_maintenance_ratio_and_amt",
|
|
|
|
|
mocker.patch(f"{EXMS}.get_maintenance_ratio_and_amt",
|
|
|
|
|
return_value=(0.01, 0.01))
|
|
|
|
|
|
|
|
|
|
# leverage = 5
|
|
|
|
@@ -601,7 +601,7 @@ def test_backtest__enter_trade_futures(default_conf_usdt, fee, mocker) -> None:
|
|
|
|
|
assert pytest.approx(trade.liquidation_price) == 0.11787191
|
|
|
|
|
|
|
|
|
|
# Stake-amount too high!
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=600.0)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=600.0)
|
|
|
|
|
|
|
|
|
|
trade = backtesting._enter_trade(pair, row=row, direction='long')
|
|
|
|
|
assert trade is None
|
|
|
|
@@ -616,9 +616,9 @@ def test_backtest__enter_trade_futures(default_conf_usdt, fee, mocker) -> None:
|
|
|
|
|
|
|
|
|
|
def test_backtest__check_trade_exit(default_conf, fee, mocker) -> None:
|
|
|
|
|
default_conf['use_exit_signal'] = False
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
default_conf['timeframe_detail'] = '1m'
|
|
|
|
|
default_conf['max_open_trades'] = 2
|
|
|
|
@@ -681,9 +681,9 @@ def test_backtest_one(default_conf, fee, mocker, testdatadir) -> None:
|
|
|
|
|
default_conf['use_exit_signal'] = False
|
|
|
|
|
default_conf['max_open_trades'] = 10
|
|
|
|
|
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
backtesting = Backtesting(default_conf)
|
|
|
|
|
backtesting._set_strategy(backtesting.strategylist[0])
|
|
|
|
@@ -766,9 +766,9 @@ def test_backtest_one(default_conf, fee, mocker, testdatadir) -> None:
|
|
|
|
|
@pytest.mark.parametrize('use_detail', [True, False])
|
|
|
|
|
def test_backtest_one_detail(default_conf_usdt, fee, mocker, testdatadir, use_detail) -> None:
|
|
|
|
|
default_conf_usdt['use_exit_signal'] = False
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
if use_detail:
|
|
|
|
|
default_conf_usdt['timeframe_detail'] = '1m'
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
@@ -854,12 +854,12 @@ def test_backtest_one_detail_futures(
|
|
|
|
|
default_conf_usdt['margin_mode'] = 'isolated'
|
|
|
|
|
default_conf_usdt['candle_type_def'] = CandleType.FUTURES
|
|
|
|
|
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
|
|
|
|
PropertyMock(return_value=['XRP/USDT:USDT']))
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_maintenance_ratio_and_amt",
|
|
|
|
|
mocker.patch(f"{EXMS}.get_maintenance_ratio_and_amt",
|
|
|
|
|
return_value=(0.01, 0.01))
|
|
|
|
|
default_conf_usdt['timeframe'] = '1h'
|
|
|
|
|
if use_detail:
|
|
|
|
@@ -945,12 +945,12 @@ def test_backtest_one_detail_futures_funding_fees(
|
|
|
|
|
default_conf_usdt['minimal_roi'] = {'0': 1}
|
|
|
|
|
default_conf_usdt['dry_run_wallet'] = 100000
|
|
|
|
|
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
|
|
|
|
PropertyMock(return_value=['XRP/USDT:USDT']))
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_maintenance_ratio_and_amt",
|
|
|
|
|
mocker.patch(f"{EXMS}.get_maintenance_ratio_and_amt",
|
|
|
|
|
return_value=(0.01, 0.01))
|
|
|
|
|
default_conf_usdt['timeframe'] = '1h'
|
|
|
|
|
if use_detail:
|
|
|
|
@@ -1010,9 +1010,9 @@ def test_backtest_timedout_entry_orders(default_conf, fee, mocker, testdatadir)
|
|
|
|
|
default_conf['startup_candle_count'] = 0
|
|
|
|
|
# Cancel unfilled order after 4 minutes on 5m timeframe.
|
|
|
|
|
default_conf["unfilledtimeout"] = {"entry": 4}
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
default_conf['max_open_trades'] = 1
|
|
|
|
|
backtesting = Backtesting(default_conf)
|
|
|
|
@@ -1035,9 +1035,9 @@ def test_backtest_timedout_entry_orders(default_conf, fee, mocker, testdatadir)
|
|
|
|
|
def test_backtest_1min_timeframe(default_conf, fee, mocker, testdatadir) -> None:
|
|
|
|
|
default_conf['use_exit_signal'] = False
|
|
|
|
|
default_conf['max_open_trades'] = 1
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
backtesting = Backtesting(default_conf)
|
|
|
|
|
backtesting._set_strategy(backtesting.strategylist[0])
|
|
|
|
@@ -1061,9 +1061,9 @@ def test_backtest_trim_no_data_left(default_conf, fee, mocker, testdatadir) -> N
|
|
|
|
|
default_conf['use_exit_signal'] = False
|
|
|
|
|
default_conf['max_open_trades'] = 10
|
|
|
|
|
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
backtesting = Backtesting(default_conf)
|
|
|
|
|
backtesting._set_strategy(backtesting.strategylist[0])
|
|
|
|
@@ -1105,9 +1105,9 @@ def test_processed(default_conf, mocker, testdatadir) -> None:
|
|
|
|
|
def test_backtest_dataprovider_analyzed_df(default_conf, fee, mocker, testdatadir) -> None:
|
|
|
|
|
default_conf['use_exit_signal'] = False
|
|
|
|
|
default_conf['max_open_trades'] = 10
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=100000)
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=100000)
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
backtesting = Backtesting(default_conf)
|
|
|
|
|
backtesting._set_strategy(backtesting.strategylist[0])
|
|
|
|
@@ -1155,9 +1155,9 @@ def test_backtest_pricecontours_protections(default_conf, fee, mocker, testdatad
|
|
|
|
|
default_conf['enable_protections'] = True
|
|
|
|
|
default_conf['timeframe'] = '1m'
|
|
|
|
|
default_conf['max_open_trades'] = 1
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
tests = [
|
|
|
|
|
['sine', 9],
|
|
|
|
|
['raise', 10],
|
|
|
|
@@ -1203,9 +1203,9 @@ def test_backtest_pricecontours(default_conf, fee, mocker, testdatadir,
|
|
|
|
|
default_conf['protections'] = protections
|
|
|
|
|
default_conf['enable_protections'] = True
|
|
|
|
|
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
# While entry-signals are unrealistic, running backtesting
|
|
|
|
|
# over and over again should not cause different results
|
|
|
|
|
|
|
|
|
@@ -1262,9 +1262,9 @@ def test_backtest_only_sell(mocker, default_conf, testdatadir):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_backtest_alternate_buy_sell(default_conf, fee, mocker, testdatadir):
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
default_conf['max_open_trades'] = 10
|
|
|
|
|
backtest_conf = _make_backtest_conf(mocker, conf=default_conf,
|
|
|
|
|
pair='UNITTEST/BTC', datadir=testdatadir)
|
|
|
|
@@ -1310,9 +1310,9 @@ def test_backtest_multi_pair(default_conf, fee, mocker, tres, pair, testdatadir)
|
|
|
|
|
dataframe['exit_short'] = 0
|
|
|
|
|
return dataframe
|
|
|
|
|
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch("freqtrade.exchange.Exchange.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
|
|
|
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
|
|
|
|
mocker.patch(f'{EXMS}.get_fee', fee)
|
|
|
|
|
patch_exchange(mocker)
|
|
|
|
|
|
|
|
|
|
pairs = ['ADA/BTC', 'DASH/BTC', 'ETH/BTC', 'LTC/BTC', 'NXT/BTC']
|
|
|
|
|