Flake8 compliance and documentation for hyperopt in strategy file
This commit is contained in:
@@ -4,7 +4,7 @@ import talib.abstract as ta
|
||||
from pandas import DataFrame
|
||||
from typing import Dict, Any, Callable
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
from hyperopt import STATUS_FAIL, STATUS_OK, Trials, fmin, hp, space_eval, tpe
|
||||
from hyperopt import hp
|
||||
from functools import reduce
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
from freqtrade.indicator_helpers import fishers_inverse
|
||||
@@ -301,7 +301,7 @@ class DefaultStrategy(IStrategy):
|
||||
{'type': 'di_cross'},
|
||||
]),
|
||||
}
|
||||
|
||||
|
||||
def buy_strategy_generator(self, params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by hyperopt
|
||||
@@ -374,7 +374,7 @@ class DefaultStrategy(IStrategy):
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
|
||||
def roi_space(self) -> Dict[str, Any]:
|
||||
return {
|
||||
'roi_t1': hp.quniform('roi_t1', 10, 120, 20),
|
||||
@@ -385,8 +385,7 @@ class DefaultStrategy(IStrategy):
|
||||
'roi_p3': hp.quniform('roi_p3', 0.01, 0.20, 0.01),
|
||||
}
|
||||
|
||||
|
||||
def stoploss_space(self) -> Dict[str, Any]:
|
||||
return {
|
||||
'stoploss': hp.quniform('stoploss', -0.5, -0.02, 0.02),
|
||||
}
|
||||
}
|
||||
|
@@ -185,16 +185,15 @@ class Strategy(object):
|
||||
Define your Hyperopt space for searching strategy parameters
|
||||
"""
|
||||
return self.custom_strategy.indicator_space()
|
||||
|
||||
|
||||
def buy_strategy_generator(self, params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by hyperopt
|
||||
"""
|
||||
return self.custom_strategy.buy_strategy_generator(params)
|
||||
|
||||
|
||||
def roi_space(self) -> Dict[str, Any]:
|
||||
return self.custom_strategy.roi_space()
|
||||
|
||||
|
||||
def stoploss_space(self) -> Dict[str, Any]:
|
||||
return self.custom_strategy.stoploss_space()
|
||||
|
Reference in New Issue
Block a user