Raise error if one of the required ordertypes is not present

This commit is contained in:
Matthias 2018-11-17 12:59:16 +01:00
parent 3ab0cf49af
commit 54a86d72f2
2 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,7 @@ DEFAULT_STRATEGY = 'DefaultStrategy'
DEFAULT_DB_PROD_URL = 'sqlite:///tradesv3.sqlite'
DEFAULT_DB_DRYRUN_URL = 'sqlite://'
UNLIMITED_STAKE_AMOUNT = 'unlimited'
REQUIRED_ORDERTYPES = ['buy', 'sell', 'stoploss']
TICKER_INTERVAL_MINUTES = {

View File

@ -84,6 +84,10 @@ class StrategyResolver(object):
else:
config['order_types'] = self.strategy.order_types
if not all(k in self.strategy.order_types for k in constants.REQUIRED_ORDERTYPES):
raise ImportError(f"Impossible to load Strategy '{self.strategy.__class__.__name__}'. "
f"Order-types mapping is incomplete.")
# Sort and apply type conversions
self.strategy.minimal_roi = OrderedDict(sorted(
{int(key): value for (key, value) in self.strategy.minimal_roi.items()}.items(),