Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Dara Batomunkueva, Tatiana Grigorovich and Andrey Nalitkin algorithm for Investment Management course

Our trading strategy consists of two parts and depends on macroeconomic trends. We distinguish between “normal” state of the world (growing or stable market) and “recession”.
Let us begin with describing our approach for “normal market”. We use “sell in May and go away” strategy that exploits seasonality of the market. From October to April, we invest into S&P 500 (obviously, it could be any other portfolio but S&P 500 is a benchmark for us). From May to September, we invest in bonds to have a relatively riskless portfolio.
Since we hold a bunch of different equities for 50% of time, we expect that market downturns will significantly damage the return of such strategy. Thus, we want to identify recessions and switch to less volatile portfolio during them.
We use Treasury Bonds’ rates as a signal of upcoming recession. When 2-year (relatively short-term) Treasuries’ rates become larger than rates for 10-year Treasuries and this relationship remains for a certain period, we know that the recession is ahead. Specifically, if smoothed difference between the 10-year rate and 2-year rate is negative for 3 consecutive months, then in one year from the last day of the third month we will switch to less risky strategy. We choose 3 months in a row to avoid having too much false “alarms” which will inevitably appear if we rely on 1-months long or 2-months long inverted yield curve.
By less risky strategy, we mean 10-year Treasury Bonds.
After we have switched to “recession” part of strategy, we want to know when to go back; otherwise, we earn less than we could earn with a “normal” strategy. For simplicity, we assume that the average crisis in the US lasts no longer than 2 years, since there were no crises that lasted 2+ years since Great Depression.
Since our strategy is a low frequency one, we expect that introducing transaction costs (which we do not have now) will have a negligible effect on the overall result.
As for the results, they are the following:
Overall return on investments is equal to 64% over 5 years. We manage to beat the market by 10% (Jensen alpha).
Sources:
Time to "sell in May and go away" algorithm by Jessica Stauth