From 2d64ab8bfeb1f94aef7c1b3d21d0c7514c1387c2 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Tue, 29 Oct 2013 08:36:53 -0400 Subject: [PATCH] BUG: Fix naive timestamps in benchmarks. Always convert the benchmarks to UTC, not just on reload. --- zipline/data/loader.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zipline/data/loader.py b/zipline/data/loader.py index 703d85c5..2a0b91bd 100644 --- a/zipline/data/loader.py +++ b/zipline/data/loader.py @@ -149,6 +149,7 @@ Fetching data from Yahoo Finance. fp_bm = get_datafile(get_benchmark_filename(bm_symbol), "rb") saved_benchmarks = pd.Series.from_csv(fp_bm) + saved_benchmarks = saved_benchmarks.tz_localize('UTC') fp_bm.close() # Find the offset of the last date for which we have trading data in our @@ -161,6 +162,7 @@ Fetching data from Yahoo Finance. # we have data,then we need to update if len(trading_days) - last_bm_date_offset > 1: benchmark_returns = update_benchmarks(bm_symbol, last_bm_date) + benchmark_returns = benchmark_returns.tz_localize('UTC') else: benchmark_returns = saved_benchmarks benchmark_returns = benchmark_returns.tz_localize('UTC')