Sorry for the confusing UX here; the warning pointing to the old Q2 migration page is just a bug. We're working on fixing it.
As for the actual content of the warning, we are indeed deprecating the universe
parameter from order_optimal_portfolio
. Previously, universe
was used to tell the optimizer which assets should considered as possible candidates for new orders. In practice, there was basically always one "correct" answer for universe
, which was "the assets referenced by your objective, unioned with assets in which you currently have a position". A common usage pattern, however, was to pass many more assets (e.g., the index of a pipeline_output
call, which might be all the assets in existence!), which then produced unexpected behavior, such as the optimizer fixing a violated constraint by spreading a large number of very small orders across all the extra assets passed in universe
.
On the latest release, we're now ignoring, universe
, and instead always using the union of the assets referenced by your objective and the assets in which you currently hold a position.
For example, if your algorithm holds a position in AAPL, and you want to sell out of that position and buy MSFT and TSLA instead, previously the correct thing to do would have been:
objective = opt.TargetPortfolioWeights({MSFT: 0.5, TSLA: 0.5, AAPL: 0.0})
constraints = []
universe = [MSFT, TSLA, AAPL]
order_optimal_portfolio(objective, constraints)
With the latest update, the equivalent invocation is simpler and less error-prone:
objective = opt.TargetPortfolioWeights({MSFT: 0.5, TSLA: 0.5, AAPL: 0.0})
# universe is inferred from objective
order_optimal_portfolio(objective, constraints)