From a12e907f5548b1b571b547c1e9e059b0bcd36242 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Thu, 9 May 2013 03:50:45 -0400 Subject: [PATCH] BUG: Fix datetime when a benchmark is the only datum in a bar. The datetime was only being set while updating the universe with the bar's trade events. Now that benchmarks are used as a clock, it is possible to have benchmarks without having trade bars during that dt, so the datetime should be updated via benchmark as well. --- zipline/gens/tradesimulation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/zipline/gens/tradesimulation.py b/zipline/gens/tradesimulation.py index 8d4e0ecf..0ecde30b 100644 --- a/zipline/gens/tradesimulation.py +++ b/zipline/gens/tradesimulation.py @@ -126,6 +126,7 @@ class AlgorithmSimulator(object): self.update_universe(event) updated = True if event.type == DATASOURCE_TYPE.BENCHMARK: + self.algo.set_datetime(event.dt) bm_updated = True txns, orders = self.algo.blotter.process_trade(event) for data in chain(txns, orders, [event]):