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.

Clone Algorithm
16
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 581ef6f51ebb491089086ae3
There was a runtime error.

2014 was a bad year :( - joel

Clone Algorithm
2
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 581f58338c3b7710a7f861d8
There was a runtime error.

Florian Kreyssig

Clone Algorithm
1
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 581f5c4723729b1093c55174
There was a runtime error.

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.