Expected Behavior
When we add multiple universes to an algorithm, the selection functions fire in the same order that we added the universes to the algorithm.
Actual Behavior
The order in which the universe selection functions are called seem random.
Potential Solution
N/A
Reproducing the Problem
Run this algorithm multiple times:
class MultipleUniverseAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2024, 9, 1)
self.set_end_date(2024, 9, 10)
self.add_universe(self._select_assets_1)
self.add_universe(self._select_assets_2)
self.add_universe(self._select_assets_3)
def _select_assets_1(self, fundamentals):
self.log(f"{self.time} - 1")
return []
def _select_assets_2(self, fundamentals):
self.log(f"{self.time} - 2")
return []
def _select_assets_3(self, fundamentals):
self.log(f"{self.time} - 3")
return []
The log file shows that sometimes the selection functions run in order 2->1->3, sometimes it's 3->2->1.
System Information
QC Cloud
Checklist
Expected Behavior
When we add multiple universes to an algorithm, the selection functions fire in the same order that we added the universes to the algorithm.
Actual Behavior
The order in which the universe selection functions are called seem random.
Potential Solution
N/A
Reproducing the Problem
Run this algorithm multiple times:
The log file shows that sometimes the selection functions run in order 2->1->3, sometimes it's 3->2->1.
System Information
QC Cloud
Checklist
masterbranch