Unusually for us, we have several changes coming out together all in a bundle. We wanted to give people a little advance notice of them. This should all ship in the next few days.
In general, we try to avoid making changes to the website that change backtest results. Backtest results should be reproducible, and if they're not, we should have a good reason why not. Some of the changes we're releasing will affect backtest results. I'm sure this is not the last time we'll do this, unfortunately, but we'll continue to keep it to the minimum. Here are the changes, listed roughly in order of how much we think they will impact backtest results.
- No more end-of-day order cancellation: Today, open orders are canceled at the end of the trading day, including partially filled orders. When we make this update, orders will no longer be cancelled automatically. Paired with this change is the ability for you to cancel orders from within your algorithm. For most backtests this won't make a difference - the orders are filled right away. Algos with orders that take more than one day to fill will see different results.
- Daylight Savings Time bugfix: Right now when you trade, the first minute bar is marked 14:31 UTC, every day. Unfortunately, that's not correct - during daylight savings time, the first bar should be 13:31 UTC. That bug will be corrected. The behavior of "sell at close" and similar strategies will need to be updated after we fix the bug. This fix will impact some of the end-of-day returns and risk metric calculations; sometimes the day was "ending" prematurely because of DST.
- Batch transform change: Batch transform will start emitting data one data bar earlier than it used to. If you have a batch transform with a window_length of 10 days, the first data emitted by batch transform is on the 11th day. The behavior will be changed to emit the first data on the 10th day. This behavior is "more correct." This change is bundled with a new rolling-datapanel implementation which will increase batch transform performance by 100X. You can see the code change on zipline.
- Slippage Update: The current implementation of slippage bundles all of your orders in a given bar (minute or daily) together before applying the slippage model. In the new release, each order is handled separately. For example, consider a scenario where your algorithm places four separate orders for 25 shares of Apple in the same minute bar (or daily bar, depending on your test mode). Today, the slippage model treats that as a single order of 100 shares when calculating the price impact. In the new release, the slippage model processes them separately: first, a 25-share trade; then another 25-share trade, with the knowledge of the previous 25 share's impact; then another 25-share trade, with the knowledge of the previous 50 shares' impact; then the final 25 shares trade, with the knowledge of the previous 75 shares' impact. This change only affects algorithms with more than one order execution of the same stock within handle_data.
We're expanding support for orders and order management. These changes won't affect backtest results. These should give everyone a lot more flexibility while writing algorithms.
- We now support limit orders, stop orders, and stop limit orders. These are in addition to the existing order type which is a market order.
- The order method will return a unique order ID which you can use in your algorithm's logic.
- You can check the status of a particular order using get_order(id)
- You can cancel an order using cancel_order(order)
- You can now see your open orders using get_open_orders(sid=sid). If the sid parameter isn't specified then it returns all open orders. If you specify a sid, it returns open orders for that sid.
UPDATE 2013-MAY-8: We are also making a change to the benchmark returns. We found a bug in our benchmark returns calculation. It will result in a small change in the benchmark, which will have some cascading effects to Sharpe, Sortino, etc.