Pair trading indices: shorting the AEX

Pair trading
Pair trading

I am Dutch and I know from first hand experience that the Dutch economy is an open economy. When world trade slows down this immediately effects the Dutch stock exchange. Although this sounds like a bad thing, I figured this could also be used as a sort of counter balance in a pair trading strategy.

Below are some graphs of my exploration of this idea.
The idea is to sell short on the AEX index and buy different other indices.

Short: blue line
Long: green line
Difference: red line

Dutch AEX against the London FTSE
Dutch AEX against the German Dax
Dutch AEX against the US S&P500
Dutch AEX against the US Nasdaq
Dutch AEX against the US Russell 2000

If you like to do your own exploring. Here is the python script that produced these graphs. Let me know if you find any other interesting pairs.

import pandas.io.data as web
import pandas
import datetime
import pylab
import math

def pairtrade(p1,p2):
    start = datetime.datetime(2008, 01, 01)
    end = datetime.datetime(2014, 03, 03)

    P1=web.DataReader(p1, 'yahoo', start, end)
    P1['Norm'] = (P1['Close'] - P1['Close'].shift(1)) /P1['Close']
    P1['Norm'] = P1['Norm'].fillna(0.0)

    P2=web.DataReader(p2, 'yahoo', start, end)
    P2['Norm'] = (P2['Close'] - P2['Close'].shift(1)) / P2['Close']
    P2['Norm'] = P2['Norm'].fillna(0.0)
    
    df = pandas.DataFrame(index = P1.index)
    df['diff'] = P2['Norm'] - P1['Norm']
    df['cum'] = df['diff'].cumsum()

    pylab.plot(P1.index,P1['Norm'].cumsum())
    pylab.plot(P2.index,P2['Norm'].cumsum())
    pylab.plot(df.index,df['cum'])
    pylab.title("Short: " + p1 + " and Long: " + p2 \
                + "\n MDD: " + str(highWM(df)) + " %" + " Sharpe: " + str(sharpe(df)))
    #pylab.show()
    pylab.savefig("Short_" + p1 + "_Long_" + p2 + ".png")
    pylab.close()
    return df

def highWM(df):
    maxDD = 0.0
    highWaterMark = 0.0
    for i in df.index:
        if df['cum'][i] < highWaterMark:
            drawDown = highWaterMark - df['cum'][i]
            if drawDown > maxDD:
                maxDD = drawDown
        if df['cum'][i] > highWaterMark:
            highWaterMark = df['cum'][i]
    return maxDD*100        

def sharpe(df):
    return ( df['diff'].mean() / df['diff'].std() ) * math.sqrt(len(df['diff']) )

def main():
    pairtrade('^aex', '^gdaxi')
    pairtrade('^aex', '^gspc')
    pairtrade('^aex', '^ftse')
    pairtrade('^aex', '^ixic')
    pairtrade('^aex', '^rut')

main()