From 519b1f00e2932d034afb76ee999f4273b8c7467a Mon Sep 17 00:00:00 2001 From: misagh Date: Sat, 24 Nov 2018 20:12:50 +0100 Subject: [PATCH] adding strategy config consistency function --- freqtrade/freqtradebot.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 126cc485f..dc1189bb9 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -54,11 +54,14 @@ class FreqtradeBot(object): # Init objects self.config = config self.strategy: IStrategy = StrategyResolver(self.config).strategy + self.check_strategy_config_consistency(config, self.strategy) + self.rpc: RPCManager = RPCManager(self) self.persistence = None self.exchange = Exchange(self.config) self.wallets = Wallets(self.exchange) + # Initializing Edge only if enabled self.edge = Edge(self.config, self.exchange, self.strategy) if \ self.config.get('edge', {}).get('enabled', False) else None @@ -66,6 +69,16 @@ class FreqtradeBot(object): self.active_pair_whitelist: List[str] = self.config['exchange']['pair_whitelist'] self._init_modules() + def check_strategy_config_consistency(self, config, strategy: IStrategy) -> None: + """ + checks if config is compatible with the given strategy + """ + + # Stoploss on exchange is only implemented for binance + if strategy.stoploss_on_exchange and config.get('exchange') is not 'binance': + raise OperationalException( + 'Stoploss limit orders are implemented only for binance as of now.') + def _init_modules(self) -> None: """ Initializes all modules and updates the config