Quantopian Automated Portfolio: Diversified US Industries

Quantopian provides fully automated portfolio strategies using algorithms.

Click the button below to launch this algorithm, which will invest your money equally in 9 US industries.

You can also visit our FAQ to learn more about live trading with Quantopian.

Returns from actual trading in $30,000 account
Loading returns chart...
Algorithm returns:
Benchmark returns (SPY):
Max drawdown:
Rebalance frequency:
21 days
Start Trading
Is my broker supported?

The Diversified US Industries algorithm was built with the help of the Quantopian community. If you're interested, you can see the code of the algorithm and join the discussion!


The challenge with maintaining an equal-weighting is that the price of the securities change. As prices move, the portfolio will drift away from equal weights. Leaders will become a bigger share of your portfolio, and laggards will become smaller. To maintain equal weights, the portfolio must be periodically rebalanced - shares of the leaders sold, and shares of the laggards bought.

The algorithm invests in each industry by buying an exchange-traded fund (ETF) that tracks the industry. The portfolio is built using the Select Sector SPDR family of ETFs, which have transparent holdings and low fees. At approximately 10:15 AM on the first trading day after you start, the algorithm will allocate your portfolio to the 9 ETFs. It will then wait 21 days (or until the next market day thereafter, should it happen to fall on a market holiday). If your portfolio has slipped out of balance, at approximately 10:15 AM the algorithm will place orders to buy and sell so that your portfiolio is rebalanced.

This process will repeat every 21 days. If you stop the algorithm, the positions remain in your brokerage account; the positions are not automatically liquidated.

This algorithm will automatically stop if it detects any positions beside the 9 constituent ETFs or cash in your brokerage account.

Learn more about live trading on Quantopian in our FAQ.

Cost Analysis:

Equal-weighting is common enough that there is even an ETF that implements equal-weighting: ALPS Equal Sector Weight ETF (ticker: EQL). EQL has an additional 0.35% maintenance fee over the fees from each component. In the table below we compare the cost of EQL with the cost of Quantopian and Interactive Brokers' commissions.

Account size EQL "rebalance" fees* Quantopian fees + broker commissions** Annual savings using Quantopian vs. EQL
$25,000 $87.50 $0  +  $51 $36.50
$250,000 $875.00 $0  +  $51 $824.00
$2,500,000 $8,750.00 $0  +  $51 $8,699.00

The Quantopian algorithm's costs come solely from trading costs. In the three months this algorithm has been running, each rebalance affects on average 3 of the 9 underlying ETFs, for a trading cost of $3 every 21 days. If every ETF were to rebalance each time, the trading cost would be $9 every 21 days.

EQL and this Quantopian algorithm rely on the same underlying ETF components which carry an expense ratio of 0.16%. For this comparison we have removed that common cost from both columns.

  • *EQL rebalance fees are estimated based on the ALPS prospectus.
  • **Broker commissions are estimated from actual transaction costs paid on a $30,000 account Quantopian has maintained since January 2014.

ETF Weight
XLB - Materials Select Sector SPDR 11.1%
XLE - Energy Select Sector SPDR 11.1%
XLF - Financial Select Sector SPDR 11.1%
XLI - Industrial Select Sector SPDR 11.1%
XLK - Technology Select Sector SPDR 11.1%
XLP - Consumer Staples Select Sector SPDR 11.1%
XLU - Utilities Select Sector SPDR 11.1%
XLV - Healthcare Select Sector SPDR 11.1%
XLY - Consumer Discretionary Select Sector SPDR 11.1%

This algorithm was written by Dr. Jess Stauth, Quantopian's VP of Quant Strategy. She is a former quant research analyst at StarMine, and former director of quant product strategy for Thomson Reuters.