From 9931812745d8a5ae8383e8536bf261cee61bff80 Mon Sep 17 00:00:00 2001 From: Thomas Wiecki Date: Thu, 27 Jun 2013 13:23:48 -0400 Subject: [PATCH] BUG: Buy/sell triggers not correct in example. Thanks @FerMartin. --- zipline/examples/pairtrade.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zipline/examples/pairtrade.py b/zipline/examples/pairtrade.py index 933402c5..5b67681d 100755 --- a/zipline/examples/pairtrade.py +++ b/zipline/examples/pairtrade.py @@ -95,8 +95,8 @@ class Pairtrade(TradingAlgorithm): self.order('KO', -int(100 / data['KO'].price)) self.invested = True elif zscore <= -2.0 and not self.invested: - self.order('KO', -int(100 / data['KO'].price)) - self.order('PEP', int(100 / data['PEP'].price)) + self.order('PEP', -int(100 / data['PEP'].price)) + self.order('KO', int(100 / data['KO'].price)) self.invested = True elif abs(zscore) < .5 and self.invested: self.sell_spread()