From fed0a9a998037904b79187ced924e1ed2d0ceb45 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Thu, 25 Apr 2013 11:30:57 -0400 Subject: [PATCH] TST: Ensure that test bars and events use midnight for daily data. Daily data should be using midnight as the timestamp, ensure that test data created by data_gen use midnight, so that upcoming implementations that rely on the timestamp will be compatible. --- zipline/sources/test_source.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zipline/sources/test_source.py b/zipline/sources/test_source.py index 84b2ef7d..f8083ad8 100644 --- a/zipline/sources/test_source.py +++ b/zipline/sources/test_source.py @@ -59,6 +59,11 @@ def date_gen(start=datetime(2006, 6, 6, 12, tzinfo=pytz.utc), """ one_day = timedelta(days=1) cur = start + if delta == one_day: + # if we are producing daily timestamps, we + # use midnight + cur = cur.replace(hour=0, minute=0, second=0, + microsecond=0) # yield count trade events, all on trading days, and # during trading hours.