Skip to content

Commit

Permalink
Merge pull request #114 from leonardojoau/master
Browse files Browse the repository at this point in the history
fixing edge case bug for change in universe
  • Loading branch information
enzbus authored Oct 31, 2023
2 parents ddb1605 + 41d15f6 commit 731f8c8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cvxportfolio/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def _change_universe(self, new_universe):
# this is the default situation with yfinance data
if self._current_universe.isin(new_universe).all():
joined = new_universe
# preprend all all the assets from full that are not in joined
joined = joined.insert(0, sorted(
set(self._current_full_universe[:-1])
- set(joined)))

# otherwise we lose the ordering :(
else:
Expand Down

0 comments on commit 731f8c8

Please sign in to comment.