Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Cross-Sectional Strategies (Ernest Chan), please help!

Hi all,

As I assume many people have already read Mr. Ernest Chan's book, this strategy is one of the strategies that he introduced in his 2nd book. It looks simple and powerful. Please help!

For those who have not read his book yet, I summarized his strategy as below:

1). Let's set our universe big.
set_universe(universe.DollarVolumeUniverse(floor_percentile=95.0,ceiling_percentile=100.0))

2). Rank the 12-month return (or 252 trading days return).
3). Buy and hold stocks within the top decile of the past 12-month returns for a month.
4). Short and hold stocks within the bottom decile of the past 12-month returns for a month.

He mentioned this strategy worked in 2007 and failed in 2008. Also he suggested that we could rank other factors, such as fundamental numbers (earnings growh, etc.) or some combination of linear statistics. So we have many options wide open.

But let's start from this one and build up from here.

I suggest that we do this with minute data to get more precise result than with daily data.
So we buy sorted stocks on the 1st day of each month and sell on the last day of each month.
On the 1st day of each month, we buy stocks at 09:32(EST) and on the last day of each month, we sell them at 15:59 (EST). For short, we do same.

Please help.

Thank you.

6 responses

Hi Brian,

It seems the backtest won't load in the thread because you posted it before it finished running. Would you mind to repost the full backtest once its done running? That's a bug on our side, thanks for pointing it out. Looking forward to seeing the graph!

Alisa

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.

So I didn't use the entry/exits you outlined to avoid unneeded buy/sells. Only the long side.

@Brian, I think your coding skill is excellent but you missed our object here. I'm not going to make any comment on your opinion. Please read Mr. Ernest Chan's 2nd book for better understanding about the strategy. Thank you.

Please help. Thank you in advance.

I cloned the first version posted, I think. It takes just under three hours to run.....

P.

FYI I found an error in my code. I'll post an update later today.

@Kyu, Thank You for the complement on my code and feel free to point out how the implementation is wrong. I don't have the book, I'm just going off the first posting. I've changed it to actually swap out the stocks every month, whether or not they move out of the top tier.

Ok. Here is the fix and I've added shorting. What I've done seems to favor shorting in this backtest. Let me know how the balance between short and long should be determined.