As mentioned here, we released the stable version of the Optimize API today. One thing mentioned in the post is that the Optimize API is required for an allocation - this post explains how that works.
Why this change?
The Optimize API allows Quantopian to intelligently adjust an algorithm's orders when external circumstances prevent us from achieving exactly the algorithm's desired portfolio. For example:
- There may not be enough short inventory for a stock
- The prime broker may restrict Quantopian from trading in certain stocks on a given day
Situations like these mean that an algorithm can't always get exactly what it wants. Optimize handles these kinds of situations by getting you to an achievable portfolio that's as close as possible to the originally desired portfolio, but also respects both the external constraints placed upon the algorithm and the constraints provided by the author.
Because these kind of situations can, and do, happen often in trading, we require algorithms to use Optimize in order to get an allocation, and every algorithm that has received an allocation to date uses Optimize.
How do I switch an existing algo over to Optimize?
If you'd like to easily port over an existing order_target_percent algorithm to use Optimize, your best bet is the TargetWeights objective. For example, if you wanted to switch over:
order_target_percent(sid(24), 0.5)
order_target_percent(sid(5861), 0.5)
to Optimize, you'd do:
order_optimal_portfolio(
objective=TargetWeights({sid(24): 0.5, sid(5861): 0.5}),
constraints=[],
)
This is a fairly basic example, but there's a lot more you can do with Optimize - head over to the docs to see what you can do with the API.
What happens to my algos that don't use Optimize?
Algorithms that don't use Optimize will still be considered for an allocation. As a part of the diligence process, we'll work with you to update your algorithm to use Optimize.