Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Significant changes, great results

Hi,

I'm not a financial guy, just a bored programmer. I made some significant changes to a reversion algorithm and wanted to get some feedback. Attached you will find a tearsheet.

6 responses

Great returns. Looks like a lot of turnover. If I may ask, what commission are you using?

Dan

Thank you your comment. My posted backtest did not include commissions. I have set the commissions to:
set_commission(commission.PerShare(cost=0.0075, min_trade_cost=1))

The algorithm will potentially replace the entire portfolio each week when it rebalances.

Steve - thanks for sharing! The universe size of the algorithm is impressive, and the large number of holdings will give the strategy a larger capacity. As you're working on the algorithm, take a look at these pieces:

  • cap the leverage at 1x
  • cap the position concentration (I'll leave the specific threshold up to you, but as a starting point I'd suggest 25%). Currently a position in the algo can take on 232% of the portfolio value
  • did you intend for the algorithm to have net short exposure? There looks to be asymmetric logic applied to the long book and short book
  • the beta is high in the algo, (0.59 in out-of-sample and oscilates between 1 and -1 on the rolling plot). Try reeling it in after the changes above. This will probably cut into your returns, but will reduce your market exposure

Good luck!

Disclaimer

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. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. 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.

This is very good feedback. I'm not quite sure how to cap the leverage and position concentration.

For my next iteration, the beta ended up at -.04 and my returns quadrupled to 122,793% between 2005-01-04 to 2016-12-02 with $12,000 initial capital. The algorithm seems more volatile with a max drawdown of -87.8%.

That drawdown/underwater plot should give you some pause, >90% drawdown is basically account suicide and being underwater most of the time is a horrible feeling, even if the occasional jumps bring you sky high you will be very tempted to bail out after more than a year with no profit at all. Maybe fixing the leverage will help with the drawdown but it won't help the underwater plot

You can use the portfolio optimization API to set constraints on your strategy to control the exposure, leverage, and position concentration: https://www.quantopian.com/posts/optimize-api-now-available-in-algorithms

I would focus less effort on improving the returns and more effort on controlling the portfolio construction. As Luke mentioned, 90% drawdown would effectively wipe out your portfolio and the algo is 8x leveraged, which a broker is unlikely to grant. If you reign in these variables, it will give you a better sense of the alpha signal in your strategy.