Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Idiosyncratic Volatility

Idiosyncratic volatility:
- Standard deviation of the residuals from regressing the stock’s daily excess returns on Fama French’s three factors is calculated.
- A stock is required to have at least 17 valid returns in a month to be included.
- The strategy longs top 10 stocks with high idiosyncratic volatility.

5 responses

nice coding.... sh!tty returns and profile though

Turns out his modified version here if run from the start date of the backtest above (2006-01-02) shows 90%.
https://www.quantopian.com/posts/betting-against-beta-and-net-stock-issues-combined-ranking

Looks to be pure shorting so one would need to consider the shorting costs and limits.
Or another route could be to try order_optimal_portfolio (without DollarNeutral) where its leverage control can eliminate some of those worries.

Your signal is the ivol, not the beta to the various FF factors, so I recommend calculating the betas over a longer time period (say one year). This should reduce turnover. You can calculate the ivol on a subset of the residuals.

Even though I don't fully understand the calculations, it seems there's an error in the for-loop starting at line 142. The index of ret_table_transpose ought to be an asset, not the counter variable i. So referring to assets[i] makes more sense to me:

    for i in range(len(assets)):  
        if assets[i] not in ret_table_transpose.columns: continue    # I wonder if this line is necessary then  
        Y = ret_table_transpose[assets[i]]  

You say, "The strategy longs top 10 stocks with high idiosyncratic volatility."

But your code mentions the word "short" 26 times. So I am confused now. Is this long only or what?

Also, you should compute your fama-french betas using something like three years of monthly data.

Additionally, you should make a long-short portfolio, so others can use it in a contest, and/or omit longs or shorts as they please.

Otherwise, good work. Just incomplete.