Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Comparing Alphalens returns to actual backtestor results

I'm not trying to do anything to complicated, I found what seemed to be a halfway decent alpha factor, and then plugged it into an algorithm and backtested it. Unfortunately, between alphalens where it was showing decent returns over the same timeframe, in the backtestor it failed rather completely. I have had this happen before with alphas that I have tested, and I am wondering what really does alphalens do to generate that returns graph, in comparison to what goes on in the backtest environment. I recognize that there is more happening with using constraints and MaximizeAlpha, but I don't think that would completely flip the returns, or maybe that is it.

Basically, are there settings you can use in the backtesting environment that give you a similar graph to what alphalens spits out, or are there some basic guidelines you can follow to point out factors like this that look alright in research but fail miserably in the algo.

Any help is appreciated

2 responses

Hey Alex,

Alphalens does not include slippage and commissions costs in its analysis, which is one of the main differences between using Alphalens in research and the backtester. Looking at the turnover and factor autocorrelation plots in Alphalens can give you a sense of how much turnover you are going to run into when you actually bring it into the IDE.

Try having a look at when you're rebalancing your factor and the turnover in the Pyfolio tear sheet as well.

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.

Thank you for the reply, this coupled with reading a lot deeper into the stats that alphalens gives out, I've since figured out what I was looking for. I had some weird things set up in my "base" algorithm that was throwing it way off, and adjusting it to what alphalens was telling me gave me a more comparable returns graph.