Introduction

Paired switching is a strategy where in its simplest form, investors pick two assets that are negatively correlated and periodically switch position based on their relative performance. The idea behind this strategy is that if the assets are negatively correlated, then a traditional mixed portfolio might lead to a lower return than the return for the individual assets. If the negative correlation exists, switching positions could improve the performance of a portfolio where two assets are statically weighted.

Method

After two negatively correlated assets are determined, we will analyze them on a quarterly basis. The analysis will consist of retrieving historical prices for the two assets and calculating their performances over the prior quarter. We will buy the asset that yields a higher return during the period. The position is held for one quarter, and then the analysis is repeated.

def rebalance(self):
    self.months +=1
    if(self.months%3==0):
        history_call = self.history(self.securities.keys,timedelta(days=90))
        if not history_call.empty:
            first_bars = history_call.loc[self.first.symbol.value]
            last_p1 = first_bars["close"].iloc[0]
            second_bars = history_call.loc[self.second.symbol.value]
            last_p2 = second_bars["close"].iloc[0]
            first_performance = (float(self.securities[self.first.symbol].price) - float(last_p1))/(float(self.securities[self.first.symbol].price))
            second_performance = (float(self.securities[self.second.symbol].price) - float(last_p2))/(float(self.securities[self.second.symbol].price))
            if(first_performance > second_performance):
                if(self.securities[self.second.symbol].invested==True):
                    self.liquidate(self.second.symbol)
                self.set_holdings(self.first.symbol,1)
            else:
                if(self.securities[self.first.symbol].invested==True):
                    self.liquidate(self.first.symbol)
                self.set_holdings(self.second.symbol,1)


Reference

  1. Quantpedia - Paired Switching