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

This is a thread we can use to post backtests etc.

5 responses

Workshop pairs trading example, for you to clone and modify.

2014 was a bad year :( - joel

Florian Kreyssig

Quick update on this. I've reported the issue with Pyfolio to Quantopian. They usually respond pretty quickly.

And the winner is: Florian!

Both Joel and Florian had worked on the pairs trading algorithm we went through in the workshop. Florian's version had an overall better return, but just as importantly, it did so with lower risk. By diversifying his trades across pairs from different sectors, he ended up with a consistently low beta to market, lower volatility, and lower position concentration.

Florian, I will connect you to Delaney to claim your prize. I recommend you try to hedge your pairs using the rolling window beta calculation we did in the workshop. Currently they are 1:1 hedged, which I suspect can be improved upon. You could also try hedging with the ratio of the stocks individual standard deviations. Since the pairs are closely related companies from the same industries, they may have similar leverage and risk factors, so their volatility may contain enough information to hedge them, and may be more stable than the OLS beta.

Note: I can't attach the PyFolio analysis just yet, as there seems to be another bug in Research.