Add ticker_interval support in strategy class
This commit is contained in:
@@ -27,6 +27,9 @@ class DefaultStrategy(IStrategy):
|
||||
# Optimal stoploss designed for the strategy
|
||||
stoploss = -0.10
|
||||
|
||||
# Optimal ticker interval for the strategy
|
||||
ticker_interval = 5
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
|
||||
"""
|
||||
Adds several different TA indicators to the given DataFrame
|
||||
|
@@ -15,7 +15,8 @@ class IStrategy(ABC):
|
||||
"""
|
||||
Attributes you can use:
|
||||
minimal_roi -> Dict: Minimal ROI designed for the strategy
|
||||
stoploss -> float: ptimal stoploss designed for the strategy
|
||||
stoploss -> float: optimal stoploss designed for the strategy
|
||||
ticker_interval -> int: value of the ticker interval to use for the strategy
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
|
@@ -41,10 +41,23 @@ class Strategy(object):
|
||||
|
||||
if 'stoploss' in config:
|
||||
self.custom_strategy.stoploss = config['stoploss']
|
||||
self.logger.info("Override strategy \'stoploss\' with value in config file.")
|
||||
self.logger.info(
|
||||
"Override strategy \'stoploss\' with value in config file: {}.".format(
|
||||
config['stoploss']
|
||||
)
|
||||
)
|
||||
|
||||
if 'ticker_interval' in config:
|
||||
self.custom_strategy.ticker_interval = config['ticker_interval']
|
||||
self.logger.info(
|
||||
"Override strategy \'ticker_interval\' with value in config file: {}.".format(
|
||||
config['ticker_interval']
|
||||
)
|
||||
)
|
||||
|
||||
self.minimal_roi = self.custom_strategy.minimal_roi
|
||||
self.stoploss = self.custom_strategy.stoploss
|
||||
self.ticker_interval = self.custom_strategy.ticker_interval
|
||||
|
||||
def _load_strategy(self, strategy_name: str) -> None:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user