From 6afc85c17da51ff85a696dbc393915d0466150aa Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Mon, 6 May 2013 16:26:38 -0400 Subject: [PATCH] BUG: Fix missing and delayed transaction last_sale_price's. Critical that trade events be last, so that the perf tracker's position information be updated with both the transaction and the trade for last_sale. Without, the first transaction would be recorded with a last_sale of 0. With @fawce --- zipline/gens/tradesimulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zipline/gens/tradesimulation.py b/zipline/gens/tradesimulation.py index 09421d10..73011605 100644 --- a/zipline/gens/tradesimulation.py +++ b/zipline/gens/tradesimulation.py @@ -128,7 +128,7 @@ class AlgorithmSimulator(object): if event.type == DATASOURCE_TYPE.BENCHMARK: bm_updated = True txns, orders = self.algo.blotter.process_trade(event) - for data in chain([event], txns, orders): + for data in chain(txns, orders, [event]): self.algo.perf_tracker.process_event(data) # Update our portfolio.