# Pair trading indices: shorting the AEX

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

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

start = datetime.datetime(2008, 01, 01)
end = datetime.datetime(2014, 03, 03)

P1['Norm'] = (P1['Close'] - P1['Close'].shift(1)) /P1['Close']
P1['Norm'] = P1['Norm'].fillna(0.0)

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():