Add ticker_interval support in strategy class

This commit is contained in:
Gerald Lonlas
2018-01-20 14:40:41 -08:00
parent 5eb7aa07a1
commit 41aa8f18fb
7 changed files with 41 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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:
"""