Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Backtest portfolio choice

Hello good people,

[First post, usually newbie disclaimers apply.]

below is a simple implementation of buy and hold strategy written purely for learning the system. Strategy buys one security as long as there is cash available, then holds all position, re-investing the dividends as they become available.

My question is: Which portfolio is used as comparison in backtesting?

Example below is trading S&P 500 ETF and by running the backtest it becomes obvious that the comparison portfolio used is also S&P 500. But what if I trade AAPL, GOOG or any other single stock? One valid test is to compare the trading strategy to an index, yet there are other valid comparisons one may want to try:

  • Compare algorithm to S&P 500 (this seems to be the default)
  • Compare algorithm with another index/ETF of my choice
  • Compare algorithm to a buy and hold strategy for the same portfolio.
  • Compare to a specified portfolio

Is there a way to specify any of the above? Documentation shows the example of using a percentage of the most liquid stocks, usefulness of which I find limited.

Thanks,

Vlatko

2 responses

At the moment I don't think there is a way to customize the benchmark. But you can easily track your own.

I modified your example by recording five custom variables that could be used as a different benchmark.

Quite useful, thanks!