From dd560ba5f05243640dbcddabe2d71b5ecb3009ee Mon Sep 17 00:00:00 2001 From: Kathryn Glowinski Date: Thu, 5 Jan 2017 14:13:23 -0500 Subject: [PATCH] BUG: Datetimes should be converted in utc. (#1635) * BUG: Datetimes should be converted in utc. * DOC: Making note of UTC req. and moving comment. --- zipline/data/us_equity_pricing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zipline/data/us_equity_pricing.py b/zipline/data/us_equity_pricing.py index 94a57e1f..e9fa2e21 100644 --- a/zipline/data/us_equity_pricing.py +++ b/zipline/data/us_equity_pricing.py @@ -1351,13 +1351,16 @@ class SQLiteAdjustmentReader(object): def _get_df_from_table(table_name, date_cols): + # Dates are stored in second resolution as ints in adj.db tables. + # Need to specifically convert them as UTC, not local time. kwargs = ( - {'parse_dates': {col: 's' for col in date_cols}} + {'parse_dates': {col: {'unit': 's', 'utc': True} + for col in date_cols} + } if convert_dates else {} ) - # Dates are stored in second resolution as ints in adj.db tables. return read_sql( 'select * from "{}"'.format(table_name), self.conn,