def _set_strategy(self, strategy: IStrategy):
     """
     Load strategy into backtesting
     """
     self.strategy: IStrategy = strategy
     strategy.dp = self.dataprovider
     # Attach Wallets to Strategy baseclass
     strategy.wallets = self.wallets
     # Set stoploss_on_exchange to false for backtesting,
     # since a "perfect" stoploss-sell is assumed anyway
     # And the regular "stoploss" function would not apply to that case
     self.strategy.order_types['stoploss_on_exchange'] = False
Exemple #2
0
 def _set_strategy(self, strategy: IStrategy):
     """
     Load strategy into backtesting
     """
     self.strategy: IStrategy = strategy
     strategy.dp = self.dataprovider
     # Set stoploss_on_exchange to false for backtesting,
     # since a "perfect" stoploss-sell is assumed anyway
     # And the regular "stoploss" function would not apply to that case
     self.strategy.order_types['stoploss_on_exchange'] = False
     if self.config.get('enable_protections', False):
         conf = self.config
         if hasattr(strategy, 'protections'):
             conf = deepcopy(conf)
             conf['protections'] = strategy.protections
         self.protections = ProtectionManager(conf)