Extract strategy-specific stuff from search logic
will allow extracting all to IResolver
This commit is contained in:
parent
790838d897
commit
89db5c6bab
@ -155,18 +155,22 @@ class StrategyResolver(IResolver):
|
|||||||
kwargs={'config': config})
|
kwargs={'config': config})
|
||||||
if strategy:
|
if strategy:
|
||||||
logger.info(f"Using resolved strategy {strategy_name} from '{module_path}'...")
|
logger.info(f"Using resolved strategy {strategy_name} from '{module_path}'...")
|
||||||
strategy._populate_fun_len = len(
|
break
|
||||||
getfullargspec(strategy.populate_indicators).args)
|
|
||||||
|
except FileNotFoundError:
|
||||||
|
logger.warning('Path "%s" does not exist.', _path.relative_to(Path.cwd()))
|
||||||
|
|
||||||
|
if strategy:
|
||||||
|
strategy._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args)
|
||||||
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
|
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
|
||||||
strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_trend).args)
|
strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_trend).args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return import_strategy(strategy, config=config)
|
return import_strategy(strategy, config=config)
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Impossible to load strategy '{strategy_name}' from {module_path}. "
|
f"Impossible to load strategy '{strategy_name}'. "
|
||||||
f"Error: {e}")
|
f"Error: {e}")
|
||||||
except FileNotFoundError:
|
|
||||||
logger.warning('Path "%s" does not exist.', _path.relative_to(Path.cwd()))
|
|
||||||
|
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
f"Impossible to load Strategy '{strategy_name}'. This class does not exist "
|
f"Impossible to load Strategy '{strategy_name}'. This class does not exist "
|
||||||
|
Loading…
Reference in New Issue
Block a user