Skip to content

Commit f037eb6

Browse files
committed
Fix market data sources initialization
1 parent da1698f commit f037eb6

File tree

1 file changed

+6
-0
lines changed
  • investing_algorithm_framework/app

1 file changed

+6
-0
lines changed

investing_algorithm_framework/app/app.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ def run(self, payload: dict = None, number_of_iterations: int = None):
426426
Returns:
427427
None
428428
"""
429+
strategy_orchestrator_service = None # Predefine to avoid UnboundLocalError
429430

430431
try:
431432
configuration_service = self.container.configuration_service()
@@ -466,6 +467,8 @@ def run(self, payload: dict = None, number_of_iterations: int = None):
466467
data_sources=self._market_data_sources,
467468
on_strategy_run_hooks=self._on_strategy_run_hooks,
468469
)
470+
self.initialize_data_sources(algorithm)
471+
469472
strategy_orchestrator_service = \
470473
self.container.strategy_orchestrator_service()
471474
strategy_orchestrator_service.initialize(algorithm)
@@ -1154,6 +1157,8 @@ def add_strategy(self, strategy, throw_exception=True) -> None:
11541157
None
11551158
"""
11561159

1160+
logger.info("Adding strategy")
1161+
11571162
if inspect.isclass(strategy):
11581163

11591164
if not issubclass(strategy, TradingStrategy):
@@ -1187,6 +1192,7 @@ def add_strategy(self, strategy, throw_exception=True) -> None:
11871192
)
11881193

11891194
if strategy.market_data_sources is not None:
1195+
logger.info("Adding market data sources from strategy")
11901196
self.add_data_sources(strategy.market_data_sources)
11911197

11921198
self._strategies.append(strategy)

0 commit comments

Comments
 (0)