Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Ranking and Trading on "Days to Cover"

At our meetups in NYC and Boston this month, Jess Stauth explained how short interest can be used as a signal for investing. She has developed a very refined model at Thomson Reuters, and we collaborated on a simplified version here.

First I built a csv file of data for "days to cover" from the Nasdaq site, and threw it into s3. "Days to cover" is the number of average volume days required to cover the total short interest in a security.

I coded the attached algorithm that chooses a universe of stocks and ranks them based on the days to cover data. The algorithm looks for changes in the top ten and bottom ten stocks in the days to cover ranking, and rebalances the portfolio to have an equal dollar investment long in the top decile, and short in the short portfolio.

In addition to the algorithm returns and benchmark returns, I recorded four intermediate values:

  • decile_count -- the number of stocks in a decile, to gauge the number of positions we're building in the portfolio
  • top_turnover -- the percentage change in the top decile. only updates when the ranking changes.
  • bottom_turnover -- the percentage change in the bottom decile. only updates when the ranking changes.
  • dtoc_is_one_count -- NASDAQ doesn't report less than 1 day to cover, so this is a check to see how many stocks in the ranking are hitting the floor.

I also chose to rebalance whenever the deciles change, rather than on a monthly or bi-monthly schedule. The rebalance is incremental, so the transaction costs shouldn't be too onerous.

I'd love to see this ported to run on minutely data, to use the quandl api, or to rebalance on a monthly schedule rather than in and "event-driven" mode. Feedback is appreciated!


aside: I mentioned my script to the guys at Quandl and they offered to put it into their mill, so now you can get short interest through their lovely api and never worry about updating the results. However, I haven't figured out yet how to get the data from quandl for a wide swath of stocks.


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.

5 responses

Hey John:

Quandl is few weeks away from being able to take a list of tickers in the API so you can download an entire exchange if you want to. End of month maybe…


Thanks Tammer! I'll keep an eye out for it.

I'm keeping an eye out for selecting the universe using a ranking :)

Just a quick update, I converted this algo to use the new order_target_value method. The new method is a bit more savvy with building the positions than my original, so the orders placed and the resulting performance differ slightly.


Re minutely data, how would that be useful since short data is only updated once every two weeks (http://www.nasdaqtrader.com/trader.aspx?id=shortintpubsch)? Or minutely just for comparison to the index?

Also, an interesting extension would be to include shorting costs. Many academic papers have pointed to the lack of incorporation of shorting costs as a distortion back testing returns, though you have chosen fairly liquid securities for this strategy.

Finally, am I correct in assuming that you are going long the stocks that have the highest days to cover (ie the most shorted stocks) and long the ones that have the lowest days to cover (lines 123 to 126)? The blog post that you refer to (and my knowledge of academic papers on this topic) indicate that we should be doing the opposite?

Quote: Aggregated open short interest level provides a profitable, low turnover signal rooted in buy-side sentiment, aka “the smart money.”

Perhaps I'm reading the code wrong -- I'm new to Python.