Here at Quantopian, your friendly neighborhood crowd-sourced asset manager, we have evaluated millions upon millions of strategies. We have also engaged hundreds of thousands of community members, like you, and carefully studied how they do their work. Recently, some of our quants got funded with up to $50 million. How did they do it?
Recently, we’ve been talking about the connection between these two sets of observations. What work habits help community members create successful strategies? Here are three habits of successful quant authors that you can adopt in your own work:
- Learn by Doing
- Focus on Alpha by Building Models
- Let the Contest be your Guide
Learning by Doing
Building a pure-alpha strategy is one of the most difficult intellectual challenges in existence. It can be daunting to think about going from a cold start to evaluating a fully formed strategy. Luckily, Quantopian’s platform provides a workflow that takes you through every phase: from working with new data, all the way through evaluating a complete strategy.
Learning our platform will help you break down the creation of a strategy into manageable steps. Depending on how you prefer to learn, there are several ways for you to get up to speed on the platform. For those who prefer to dive into a hands on experience, you can start with Getting Started, which will walk you through the steps. Folks who like to have a more formal introduction to the financial and statistical concepts could start with our lecture series. If you like to imagine the big picture before doing either of those learning activities, check out our short video or blog post on the Quant Workflow to get that aerial view of all the steps. If you want an even deeper dive, check out this longer webinar on going from an idea to a full strategy.
Focus on Alpha by Building Models
The hardest and most valuable work is identifying alpha: an exploitable market inefficiency. Inefficiencies are hard to find and also difficult to verify. Our philosophy at Quantopian is to do our best to cover all the non-alpha production work, so our community can focus on the hardest (but also funnest) part of the problem.
One of the standout habits of quants who successfully find alpha is research work. Nearly all of their working time is spent in our research environment. The research environment is based on Jupyter Notebooks, which provide an interactive coding environment. That means you can type a little code, run it, and see the output. That is a short creative loop, which will tend to help you focus. That short loop environment is phenomenal for creating the type of strategy we work with here: cross-sectional equity strategies. These strategies find small market inefficiencies in large numbers of stocks. The general idea is to come up with a hypothesis, use that to define a model, and then test your hypothesis by evaluating the model. The hypothesis might be:
Companies recently experiencing extremely high price/equity ratios are likely to revert to the sector mean price/equity ratio within 7 days.
From this you’d construct a model which took historical and current price/equity ratios into account, and made a forecast about the 7 day return of each stock. This forecast, or score, per stock is commonly referred to as an alpha factor. The alpha factor describes the market inefficiency you’re exploring in two steps:
- First, by scoring every stock in your universe in a consistent way. This scoring is the alpha factor definition.
- Second, by ranking every stock in your universe using that score. Ideally, you’ll find a linear relationship between your score and the returns of all the stocks in your universe (higher score, higher returns / lower score, lower returns). The strength of the relationship is the expected efficacy of your alpha factor.
Quantopian provides two specialized programming libraries (python modules) that help you with each step. Pipeline is application programming interface (API) for defining alpha factors based on your model. You can learn about it in the Getting Started Tutorial, or you can try the Pipeline Tutorial, or you can read the Pipeline programming documentation.
Once you have defined your alpha factor in Pipeline, you’ll want to evaluate it. That’s where the Alphalens library comes into the picture. Alphalens combines all the alpha factor evaluation studies that we have developed at Quantopian into a single package. Alphalens is also a free-standing open source library (created and maintained by the Quantopian team). Among professional quants in the industry, Alphalens is our most popular open source library.
You should expect to spend around 90% of your effort in the development of your models and alpha factors. Alpha factors are the simplest and most idealized version of your investment idea, and testing them just comes down to testing a hypothesis as you would in any scientific field. Everything else you layer on top of your alpha factor (with the exception of mixing factors together) to create a full blown strategy (construct the portfolio, trade into positions, limit risk and exposure) will tend to decrease the efficacy of your alpha factors. So, the quickest way to rule something out is to explore the alpha factor. If it doesn’t work in isolation, you won’t fix it by adding the headwinds that come with building an algorithm around it.
You should be absolutely paranoid about overfitting. We have determined many times over that overfitting is the single biggest mistake made by quants on our platform. At a minimum, limit the date range of the data you test with. Quantopian has >10 years of history available for you to do research and testing. Limit your in-sample portion (the section of data you use while developing your model) to about half of the available history. Save the rest of the data to validate your model when you think you have something working, and to validate the full strategy.
Let the Contest be your Guide
Speaking of creating a full strategy, the best authors use the contest criteria and the closely aligned full backtest screen to build from alpha factor to full blown strategy. When you run a full backtest on the platform, the user interface will highlight the criteria you have yet to meet. There’s even links to the relevant tutorials/documentation/examples to help you address any of the structural issues. Once you have done the hard creative work of devising a model and alpha factor (or several), we’ve made addressing the portfolio construction comparatively straight forward. Here is a template into which you can copy-paste your alpha factor(s) before backtesting them and submitting them to the contest.
The contest is framed as an optimization problem; there is a combination of constraints and a utility function you need to optimize. The constraints are our entry requirements, all of which can be checked in-sample with a backtest and our full backtest output. The contest scoring is the utility function you need to optimize. The scoring function rewards consistent performance over live data.
We based both the entry requirements and the scoring function on everything we learned from the first year and a half managing our fund. If you can find an alpha factor with predictive power and avoid overfitting, you’ll do well in our contest, and give your strategy the best chance to get funded.