Removed changes from tests/strategy/strats that hyperopted short parameters, because these are supposed to be legacy tests

This commit is contained in:
Sam Germain 2021-08-22 21:38:15 -06:00
parent 5ca3f49cb5
commit 8644449c33
5 changed files with 3 additions and 82 deletions

View File

@ -130,19 +130,6 @@ class DefaultStrategy(IStrategy):
),
'buy'] = 1
dataframe.loc[
(
(dataframe['rsi'] > 65) &
(dataframe['fastd'] > 65) &
(dataframe['adx'] < 70) &
(dataframe['plus_di'] < 0.5) # TODO-lev: What to do here
) |
(
(dataframe['adx'] < 35) &
(dataframe['plus_di'] < 0.5) # TODO-lev: What to do here
),
'enter_short'] = 1
return dataframe
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
@ -166,20 +153,4 @@ class DefaultStrategy(IStrategy):
(dataframe['minus_di'] > 0.5)
),
'sell'] = 1
dataframe.loc[
(
(
(qtpylib.crossed_below(dataframe['rsi'], 30)) |
(qtpylib.crossed_below(dataframe['fastd'], 30))
) &
(dataframe['adx'] < 90) &
(dataframe['minus_di'] < 0) # TODO-lev: what to do here
) |
(
(dataframe['adx'] > 30) &
(dataframe['minus_di'] < 0.5) # TODO-lev: what to do here
),
'exit_short'] = 1
return dataframe

View File

@ -60,15 +60,6 @@ class HyperoptableStrategy(IStrategy):
'sell_minusdi': 0.4
}
enter_short_params = {
'short_rsi': 65,
}
exit_short_params = {
'exit_short_rsi': 26,
'exit_short_minusdi': 0.6
}
buy_rsi = IntParameter([0, 50], default=30, space='buy')
buy_plusdi = RealParameter(low=0, high=1, default=0.5, space='buy')
sell_rsi = IntParameter(low=50, high=100, default=70, space='sell')
@ -87,12 +78,6 @@ class HyperoptableStrategy(IStrategy):
})
return prot
enter_short_rsi = IntParameter([50, 100], default=70, space='sell')
enter_short_plusdi = RealParameter(low=0, high=1, default=0.5, space='sell')
exit_short_rsi = IntParameter(low=0, high=50, default=30, space='buy')
exit_short_minusdi = DecimalParameter(low=0, high=1, default=0.4999, decimals=3, space='buy',
load=False)
def informative_pairs(self):
"""
Define additional, informative pair/interval combinations to be cached from the exchange.
@ -175,19 +160,6 @@ class HyperoptableStrategy(IStrategy):
),
'buy'] = 1
dataframe.loc[
(
(dataframe['rsi'] > self.enter_short_rsi.value) &
(dataframe['fastd'] > 65) &
(dataframe['adx'] < 70) &
(dataframe['plus_di'] < self.enter_short_plusdi.value)
) |
(
(dataframe['adx'] < 35) &
(dataframe['plus_di'] < self.enter_short_plusdi.value)
),
'enter_short'] = 1
return dataframe
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
@ -211,20 +183,4 @@ class HyperoptableStrategy(IStrategy):
(dataframe['minus_di'] > self.sell_minusdi.value)
),
'sell'] = 1
dataframe.loc[
(
(
(qtpylib.crossed_below(dataframe['rsi'], self.exit_short_rsi.value)) |
(qtpylib.crossed_below(dataframe['fastd'], 30))
) &
(dataframe['adx'] < 90) &
(dataframe['minus_di'] < 0) # TODO-lev: What should this be
) |
(
(dataframe['adx'] < 30) &
(dataframe['minus_di'] < self.exit_short_minusdi.value)
),
'exit_short'] = 1
return dataframe

View File

@ -84,5 +84,4 @@ class TestStrategyLegacy(IStrategy):
(dataframe['volume'] > 0)
),
'sell'] = 1
return dataframe

View File

@ -747,11 +747,10 @@ def test_auto_hyperopt_interface(default_conf):
assert strategy.sell_minusdi.value == 0.5
all_params = strategy.detect_all_parameters()
assert isinstance(all_params, dict)
# TODO-lev: Should these be 4,4 and 10?
assert len(all_params['buy']) == 4
assert len(all_params['sell']) == 4
assert len(all_params['buy']) == 2
assert len(all_params['sell']) == 2
# Number of Hyperoptable parameters
assert all_params['count'] == 10
assert all_params['count'] == 6
strategy.__class__.sell_rsi = IntParameter([0, 10], default=5, space='buy')

View File

@ -119,11 +119,9 @@ def test_strategy(result, default_conf):
dataframe = strategy.advise_buy(df_indicators, metadata=metadata)
assert 'buy' in dataframe.columns
assert 'enter_short' in dataframe.columns
dataframe = strategy.advise_sell(df_indicators, metadata=metadata)
assert 'sell' in dataframe.columns
assert 'exit_short' in dataframe.columns
def test_strategy_override_minimal_roi(caplog, default_conf):
@ -415,9 +413,7 @@ def test_strategy_interface_versioning(result, monkeypatch, default_conf):
enterdf = strategy.advise_buy(result, metadata=metadata)
assert isinstance(enterdf, DataFrame)
assert 'buy' in enterdf.columns
assert 'enter_short' in enterdf.columns
exitdf = strategy.advise_sell(result, metadata=metadata)
assert isinstance(exitdf, DataFrame)
assert 'sell' in exitdf
assert 'exit_short' in exitdf.columns