Back to Community
New Feature! set_universe Is Live

We're happy to share a new feature with you - set_universe.

set_universe is important because it helps you remove yet another potential source of bias from your algorithm. Up until now, Quantopian has only supported testing up to ten, hand-picked securities. The risk is that your ten stocks might not be a valid sample, and you can learn the wrong lesson from your testing. With set_universe, you can eliminate the bias of your stock picks and replace them with a cross-section of stocks based on their ranked dollarvolume. Quantopian already helps you avoid risks like survivorship bias and look-ahead bias. Now we're helping your remove stock picking bias, too.

There is a much longer description in our help documentation, but here is a short version to get you started. And of course, you can clone the sample algorithm below.

def initialize(context):  
    set_universe(universe.DollarVolumeUniverse(floor_percentile=98.0, ceiling_percentile=100.0))  

The paint is still wet on this feature; as you find bugs, missing documentation, or more general suggestions, please let us know. You can either reply to this thread or drop us a note at As we've done our internal testing we've found this feature is particularly good at finding problems with our data source. We found several missing dividends and a few other odds and ends, and I expect there are still a few more waiting to be found. Please let us know.

Clone Algorithm
Backtest from to with initial capital
Total Returns
Max Drawdown
Benchmark Returns
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 512f89dccc862908bbc01f3d
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.

2 responses

Simply awesome, thanks Dan!

Can we get all of the stocks available in Quantopian using: set_universe(universe.DollarVolumeUniverse(floor_percentile=1.0, ceiling_percentile=100.0)) ?