Raise error if one of the required ordertypes is not present
This commit is contained in:
parent
3ab0cf49af
commit
54a86d72f2
@ -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 = {
|
||||
|
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user