quantopian/zipline — pull request #137 by jlowin (2013-04-19 00:12:37+00:00)
Title: New order methods

Note this replaces #104, which got ugly after trying to rebase with the new order types from #102. These now all support limit_price and stop_price.

Adds to `AlgorithmSimulator`:
- `order_value()`, which wraps `order()` and allows a dollar value for the order to be provided instead of a number of shares.

Adds to `TradingAlgorithm`:
- `order_value()`, which allows an order to be specified as a dollar value (and is a call to the underlying `AlgorithmSimulator`'s `order_value()` method, just like `order()`).
- `order_percent()`, which allows an order to be specified as a [decimal] percent of the current portfolio value.
- `target()`, which places an order to adjust a position to the target number of shares
- `target_value()`, which places an order to adjust a position to the target value
- `target_percent()`, which places an order to adjust a position to the target percent of current portfolio value