From 44f993c64e0fed26937aaa536a9980ef1b1dad12 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Tue, 18 Nov 2014 16:54:04 -0500 Subject: [PATCH] BUG: Use astimezone instead of tz_convert. Makes get_datetime agnostic as to whether its input is a datetime or a Timestamp. (astimezone is an alias to tz_convert when the input is a Timestamp). --- zipline/algorithm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zipline/algorithm.py b/zipline/algorithm.py index bf5c3b24..a7dce8e2 100644 --- a/zipline/algorithm.py +++ b/zipline/algorithm.py @@ -784,7 +784,7 @@ class TradingAlgorithm(object): assert date_copy.tzinfo == pytz.utc, \ "Algorithm should have a utc datetime" if tz is not None: - date_copy = date_copy.tz_convert(tz) + date_copy = date_copy.astimezone(tz) return date_copy def set_transact(self, transact):