DEV: Add tz kwarg to get_datetime.

This commit is contained in:
Scott Sanderson
2014-10-21 22:36:17 -04:00
parent 820115f7be
commit affeb2afbc
2 changed files with 60 additions and 2 deletions
+3 -1
View File
@@ -746,13 +746,15 @@ class TradingAlgorithm(object):
self.blotter.set_date(dt)
@api_method
def get_datetime(self):
def get_datetime(self, tz=None):
"""
Returns a copy of the datetime.
"""
date_copy = copy(self.datetime)
assert date_copy.tzinfo == pytz.utc, \
"Algorithm should have a utc datetime"
if tz is not None:
date_copy = date_copy.tz_convert(tz)
return date_copy
def set_transact(self, transact):