Move experimental settings to ask_strategy

This commit is contained in:
hroff-1902
2019-10-05 13:29:59 +03:00
parent e93bbd3831
commit 9b23376415
15 changed files with 82 additions and 81 deletions

View File

@@ -103,11 +103,6 @@
"max_trade_duration_minute": 1440,
"remove_pumps": false
},
"experimental": {
"use_sell_signal": false,
"sell_profit_only": false,
"ignore_roi_if_buy_signal": false
},
"telegram": {
// We can now comment out some settings
// "enabled": true,

View File

@@ -285,7 +285,7 @@ def test_backtest_results(default_conf, fee, mocker, caplog, data) -> None:
if data.trailing_stop_positive:
default_conf["trailing_stop_positive"] = data.trailing_stop_positive
default_conf["trailing_stop_positive_offset"] = data.trailing_stop_positive_offset
default_conf["experimental"] = {"use_sell_signal": data.use_sell_signal}
default_conf["ask_strategy"] = {"use_sell_signal": data.use_sell_signal}
mocker.patch("freqtrade.exchange.Exchange.get_fee", MagicMock(return_value=0.0))
patch_exchange(mocker)

View File

@@ -507,6 +507,7 @@ def test_backtesting_start_no_data(default_conf, mocker, caplog, testdatadir) ->
def test_backtest(default_conf, fee, mocker, testdatadir) -> None:
default_conf['ask_strategy']['use_sell_signal'] = False
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
patch_exchange(mocker)
backtesting = Backtesting(default_conf)
@@ -561,6 +562,7 @@ def test_backtest(default_conf, fee, mocker, testdatadir) -> None:
def test_backtest_1min_ticker_interval(default_conf, fee, mocker, testdatadir) -> None:
default_conf['ask_strategy']['use_sell_signal'] = False
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
patch_exchange(mocker)
backtesting = Backtesting(default_conf)
@@ -603,8 +605,9 @@ def test_backtest_pricecontours(default_conf, fee, mocker, testdatadir) -> None:
# TODO: Evaluate usefullness of this, the patterns and buy-signls are unrealistic
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
tests = [['raise', 19], ['lower', 0], ['sine', 35]]
# We need to enable sell-signal - otherwise it sells on ROI!!
default_conf['experimental'] = {"use_sell_signal": True}
# use_sell_signal is True by default now, it will sell on the sell signal instead of ROI,
# which is what we need here
# default_conf['ask_strategy'] = {"use_sell_signal": True}
for [contour, numres] in tests:
simple_backtest(default_conf, contour, numres, mocker, testdatadir)
@@ -645,8 +648,9 @@ def test_backtest_alternate_buy_sell(default_conf, fee, mocker, testdatadir):
mocker.patch('freqtrade.optimize.backtesting.file_dump_json', MagicMock())
backtest_conf = _make_backtest_conf(mocker, conf=default_conf,
pair='UNITTEST/BTC', datadir=testdatadir)
# We need to enable sell-signal - otherwise it sells on ROI!!
default_conf['experimental'] = {"use_sell_signal": True}
# use_sell_signal is True by default now, it will sell on the sell signal instead of ROI,
# which is what we need here
# default_conf['ask_strategy'] = {"use_sell_signal": True}
default_conf['ticker_interval'] = '1m'
backtesting = Backtesting(default_conf)
backtesting.strategy.advise_buy = _trend_alternate # Override
@@ -687,8 +691,9 @@ def test_backtest_multi_pair(default_conf, fee, mocker, tres, pair, testdatadir)
# Remove data for one pair from the beginning of the data
data[pair] = data[pair][tres:].reset_index()
# We need to enable sell-signal - otherwise it sells on ROI!!
default_conf['experimental'] = {"use_sell_signal": True}
# use_sell_signal is True by default now, it will sell on the sell signal instead of ROI,
# which is what we need here
# default_conf['ask_strategy'] = {"use_sell_signal": True}
default_conf['ticker_interval'] = '5m'
backtesting = Backtesting(default_conf)

View File

@@ -256,23 +256,23 @@ def test_strategy_override_use_sell_signal(caplog, default_conf):
'strategy': 'DefaultStrategy',
})
resolver = StrategyResolver(default_conf)
assert not resolver.strategy.use_sell_signal
assert resolver.strategy.use_sell_signal
assert isinstance(resolver.strategy.use_sell_signal, bool)
# must be inserted to configuration
assert 'use_sell_signal' in default_conf['experimental']
assert not default_conf['experimental']['use_sell_signal']
assert 'use_sell_signal' in default_conf['ask_strategy']
assert default_conf['ask_strategy']['use_sell_signal']
default_conf.update({
'strategy': 'DefaultStrategy',
'experimental': {
'use_sell_signal': True,
'ask_strategy': {
'use_sell_signal': False,
},
})
resolver = StrategyResolver(default_conf)
assert resolver.strategy.use_sell_signal
assert not resolver.strategy.use_sell_signal
assert isinstance(resolver.strategy.use_sell_signal, bool)
assert log_has("Override strategy 'use_sell_signal' with value in config file: True.", caplog)
assert log_has("Override strategy 'use_sell_signal' with value in config file: False.", caplog)
def test_strategy_override_use_sell_profit_only(caplog, default_conf):
@@ -284,12 +284,12 @@ def test_strategy_override_use_sell_profit_only(caplog, default_conf):
assert not resolver.strategy.sell_profit_only
assert isinstance(resolver.strategy.sell_profit_only, bool)
# must be inserted to configuration
assert 'sell_profit_only' in default_conf['experimental']
assert not default_conf['experimental']['sell_profit_only']
assert 'sell_profit_only' in default_conf['ask_strategy']
assert not default_conf['ask_strategy']['sell_profit_only']
default_conf.update({
'strategy': 'DefaultStrategy',
'experimental': {
'ask_strategy': {
'sell_profit_only': True,
},
})

View File

@@ -1768,8 +1768,6 @@ def test_handle_trade(default_conf, limit_buy_order, limit_sell_order,
def test_handle_overlpapping_signals(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
default_conf.update({'experimental': {'use_sell_signal': True}})
patch_RPCManager(mocker)
patch_exchange(mocker)
mocker.patch.multiple(
@@ -1824,7 +1822,6 @@ def test_handle_overlpapping_signals(default_conf, ticker, limit_buy_order,
def test_handle_trade_roi(default_conf, ticker, limit_buy_order,
fee, mocker, markets, caplog) -> None:
caplog.set_level(logging.DEBUG)
default_conf.update({'experimental': {'use_sell_signal': True}})
patch_RPCManager(mocker)
patch_exchange(mocker)
@@ -1856,10 +1853,10 @@ def test_handle_trade_roi(default_conf, ticker, limit_buy_order,
caplog)
def test_handle_trade_experimental(
def test_handle_trade_use_sell_signal(
default_conf, ticker, limit_buy_order, fee, mocker, markets, caplog) -> None:
# use_sell_signal is True buy default
caplog.set_level(logging.DEBUG)
default_conf.update({'experimental': {'use_sell_signal': True}})
patch_RPCManager(mocker)
patch_exchange(mocker)
mocker.patch.multiple(
@@ -2600,7 +2597,7 @@ def test_sell_profit_only_enable_profit(default_conf, limit_buy_order,
get_fee=fee,
markets=PropertyMock(return_value=markets)
)
default_conf['experimental'] = {
default_conf['ask_strategy'] = {
'use_sell_signal': True,
'sell_profit_only': True,
}
@@ -2632,7 +2629,7 @@ def test_sell_profit_only_disable_profit(default_conf, limit_buy_order,
get_fee=fee,
markets=PropertyMock(return_value=markets)
)
default_conf['experimental'] = {
default_conf['ask_strategy'] = {
'use_sell_signal': True,
'sell_profit_only': False,
}
@@ -2662,7 +2659,7 @@ def test_sell_profit_only_enable_loss(default_conf, limit_buy_order, fee, market
get_fee=fee,
markets=PropertyMock(return_value=markets)
)
default_conf['experimental'] = {
default_conf['ask_strategy'] = {
'use_sell_signal': True,
'sell_profit_only': True,
}
@@ -2692,7 +2689,7 @@ def test_sell_profit_only_disable_loss(default_conf, limit_buy_order, fee, marke
get_fee=fee,
markets=PropertyMock(return_value=markets)
)
default_conf['experimental'] = {
default_conf['ask_strategy'] = {
'use_sell_signal': True,
'sell_profit_only': False,
}
@@ -2761,7 +2758,7 @@ def test_ignore_roi_if_buy_signal(default_conf, limit_buy_order, fee, markets, m
get_fee=fee,
markets=PropertyMock(return_value=markets)
)
default_conf['experimental'] = {
default_conf['ask_strategy'] = {
'ignore_roi_if_buy_signal': True
}
freqtrade = FreqtradeBot(default_conf)
@@ -3029,7 +3026,7 @@ def test_disable_ignore_roi_if_buy_signal(default_conf, limit_buy_order,
get_fee=fee,
markets=PropertyMock(return_value=markets)
)
default_conf['experimental'] = {
default_conf['ask_strategy'] = {
'ignore_roi_if_buy_signal': False
}
freqtrade = FreqtradeBot(default_conf)