Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
"volatility strategies" - what are they?

I've seen lots of posts on so-called "volatility strategies" - what are they? Why are they so popular? What is the underlying principle/economic condition that makes them profitable?

Perhaps someone can shed some high-level light on this thing? The various threads are bogged down in various tweaks to this-or-that particular strategy. I'm interested in a more elevated view.

Thanks,

Grant

15 responses

Thanks Tim - looks to be quite an extensive paper! --Grant

Hi Grant,

Here's a very simple volatility trading algo that I cobbled together. It's based on the fact that XIV and the market are highly correlated.

If you decide to delve into this sort of strategies, I would appreciate receiving your comments and suggestions for improvement.

Regards,

Tim

And here's a more docile version.

Strange, now I notice that they have virtually exactly the same shape -- what's going on here? ...

Pardon my interruption from the volatility topic here, I just want you guys to be doing your best.
I don't know the answer to your question however run this an see if you figure out what happened in Feb 2014 with the sudden margin in your first algo. track_orders is set to begin 2014-02-21. Maybe RSP hit a point where everybody was selling?

2013-12-02 08:10 _pvr:122 INFO PvR 0.3963 %/day   cagr 0.6   Portfolio value 82284   PnL 62284  
2013-12-02 08:10 _pvr:123 INFO   Profited 62284 on 20787 activated/transacted for PvR of 299.6%  
2013-12-02 08:10 _pvr:124 INFO   QRet 311.42 PvR 299.63 CshLw -787 MxLv 1.01 RskHi 20787 MxShrt 0  
2014-02-25 07:00 _orders:276 INFO   30   Sell -571 RSP at 72.11   cash 12  
2014-02-25 07:00 _orders:276 INFO   30   Buy 1303 XIV at 31.62   cash 12  
2014-02-25 07:01 pvr:205 INFO  31 Lv 1.5 MxLv 1.47 QRet 311.9 PvR 106.7 PnL 62377 Cash -38468 CshLw -38468 Shrt 0 MxShrt 0 oShrt 0 Risk 58468 RskHi 58468  
2014-02-25 07:02 _orders:276 INFO   32      Bot 1303 XIV at 31.57   cash -37603  
2014-02-25 07:07 _orders:276 INFO   37      Sold -128/-571 RSP at 72.02   cash -31915  
2014-02-25 07:15 _orders:276 INFO   45      Sold -176/-571 RSP at 72.12   cash -19221  
2014-02-25 07:24 _orders:276 INFO   54      Sold -571 RSP at 72.28   cash 51  
2014-02-26 07:00 _orders:276 INFO   30   Buy 1 XIV at 31.65   cash 51  
2014-02-26 07:02 _orders:276 INFO   32      Bot 1 XIV at 31.85   cash 19  

Remember, margin is discarded in returns. The profit on amount invested plunged from 300% to 107% due to the negative cash. (PvR looks at profit on the amount actually invested no matter how much capital at the beginning). So a little bit later in the log you can see that it had profited 71,020 however it took 58,468 (38k invisible) to achieve that (sudden jump) for PvR of a mere 122% (Q return is 355% at that point). You can see the three times it happened (in a big way) in the custom chart here. One approach could be to schedule closing of positions before opens.

Thank you so much, Blue, your PvR tool is really invaluable. I should remember to always use it.

I believe I have now somehow brought the leverage and the negative cash under control (although not 100%), but the returns are of course much less.

Here is the second algo with the PvR controls implemented. Thanks again, Blue!

If someone would like to summarize that paper on volatility and what's happening in these backtests, like, so a five-year-old can understand, my gratitude.

The latest first algo is nearly 200 percentage points higher in PvR than the original. Since this is not the easiest thing in the world to understand, lemme try to clarify for folks this way: Imagine you start out with $10 and buy a share of SPY each day for several years. The backtester will show you astronomical returns because it treats the negative cash as if it never happened, it says, wow, you spent just $10 and made a fortune so that's a great return.

The first algo appears to be 680%. However it spent 83,185 to make 137,506. So, whoever the reader might be, think to yourself, are the returns 680%? No that's 165%. Tim's revision is 350%, great job. Anyway ...

PnL per stock added to your latest first algo here in the custom chart so you can see what each one is up to. track_orders turned off for speed this time.

Second algo: If I'm not mistaken, with dropna(), any time one stock has a NaN, the day's data is dropped for all stocks, entire row. One possibility might be to use back fill and forward fill instead. Try replacing .dropna() with .bfill().ffill()

Blue, would you provide some guidance for using your PvR tool? In particular, which values would be considered good, excellent, bad, or terrible? And are there any other things to watch out for?

Answered here.

If someone would like to summarize that paper on volatility and what's happening in these backtests, like, so a five-year-old can understand, my gratitude.

I'm not so interested in particular backtests, but rather a bit more background. What's this VIX thingy, anyway? And why should I care? I see that it is "a popular measure of the implied volatility of S&P 500 index options" (reference), which sounds like a bunch of financial voodoo (no offense to any finance witch doctors out there). And then we have XIV and VXX, which are ETFs that are based on the VIX. Even more voodoo. If I buy a share in XIV or VXX, what do I have? If I buy a share of SPY, then I think I could explain it to a five-year-old. I'd kinda-sorta "own" little pieces of lots of companies, and one could imagine various analogies that would be acceptable to a five-year-old (keeping in mind that one has 30 sec. to a minute max. of attention span).

Grant,

I just provided the backtests as a basic example of a "volatility" algo, that is all. I am not particularly proud of them, but I cannot do much better then this at the moment, I am afraid.

I must admit that I have only read the article that I gave a link to superficially, although I do hope to find the time to study it in some more detail. I take a very pragmatic view towards the VIX and the relatd ETFs: they offer a retail trader the possibility of trading volatility. By this I mean that using them one can bet on the S&P 500 volatility rising or falling, much like betting on the rise or the fall of the index itself, except that volatility posesses different properties from those of the stocks themselves, i.e., it is said to be (more) predictable and to exhibit mean reversion characteristics. (I am sure you know much more about it then I do)

It is my understanding that option traders do the same for most part of their trading (trying to forecast volatilty, that is), but if you do not have access to options, the VIX and its ETFs are your best alternative, I suppose ...

Blue,

Great explanation by (a straightforard) example why leverage control is so important!

They asked us nicely to write our bug reports so a five-year-old could understand, at Microsoft. For the developers.
Thank you Tim, you understand. At the risk of belaboring the point, to try to help make that crystal clear for others, this backtest appears to make a 100x profit from $500, just that the margin leverage was discarded in the returns calculation and it doesn't work that way in the real world. PvR on the other hand reports this as a 26% return because it takes the negative cash into account.

def initialize(context):  
    schedule_function(buy, date_rules.every_day(), time_rules.market_open())

def buy(context,data):  
    order(symbol('SPY'), 1)  
    record(PnL = context.portfolio.pnl)  

And back on point, whew, this volatility trading is tough to wrap one's head around in my opinion ...

The trader will try to achieve a higher profit by finding an instrument in which the implied (market) volatility is higher or lower than the trader’s forecast for the actual realised profit. source

By the way I wonder if pandas variance [.var()] can be used on history() output for volatility.