quantopian/zipline — pull request #228 by pcawthron (2013-10-16 14:40:15+00:00)
Title: Fix handling of STOP, LIMIT and STOP LIMIT Orders

Includes specific handling of Buy Stop, Sell Stop, Buy Limit, Sell
Limit, Buy Stop Limit and Sell Stop Limit orders.

Tested with 'AAPL' from 2008-01-25 to 2008-04-01 where the first day's close was 126.44 i.e.

1. Buy Stop
self.order('AAPL', -100,)
self.order('AAPL', 100, stop_price=129.00)

2. Sell Stop
self.order('AAPL', 100,)
self.order('AAPL', -100, stop_price=118.00)

3. Buy Limit
self.order('AAPL', 100, limit_price=119.00)

4. Sell Limit
self.order('AAPL', -100, limit_price=131.00)

5. Buy Stop Limit
self.order('AAPL', 100, limit_price=128.53, stop_price=128.50)

6. Sell Stop Limit
self.order('AAPL', -100, limit_price=123.00, stop_price=125.60)