MAINT: Using zone attribute of tzinfo instead of string

This commit is contained in:
Richard Frank
2013-03-24 11:59:23 -04:00
committed by Eddie Hebert
parent fdf38d3562
commit eb6b7c08fc
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -219,7 +219,7 @@ Last successful date: %s" % self.market_open)
# create a new Delorean with the next_open naive date and
# the correct timezone for the exchange.
open_delorean = Delorean(next_open, self.exchange_tz)
open_utc = open_delorean.shift("UTC").datetime
open_utc = open_delorean.shift(pytz.utc.zone).datetime
market_open = open_utc
market_close = market_open + self.get_trading_day_duration(open_utc)
+2 -2
View File
@@ -118,14 +118,14 @@ check treasury and benchmark data in findb, and re-run the test."""
def get_next_trading_dt(current, interval):
naive = current.replace(tzinfo=None)
delo = Delorean(naive, "UTC")
delo = Delorean(naive, pytz.utc.zone)
ex_tz = trading.environment.exchange_tz
next_dt = delo.shift(ex_tz).datetime
while True:
next_dt = next_dt + interval
next_delo = Delorean(next_dt.replace(tzinfo=None), ex_tz)
next_utc = next_delo.shift("UTC").datetime
next_utc = next_delo.shift(pytz.utc.zone).datetime
if trading.environment.is_market_hours(next_utc):
break
+2 -2
View File
@@ -22,8 +22,8 @@ from dateutil import rrule
from delorean import Delorean
start = datetime(1990, 1, 1, tzinfo=pytz.utc)
end_dln = Delorean(datetime.utcnow(), 'UTC')
end_dln.shift('US/Eastern').truncate('day').shift('UTC')
end_dln = Delorean(datetime.utcnow(), pytz.utc.zone)
end_dln.shift('US/Eastern').truncate('day').shift(pytz.utc.zone)
end = end_dln.datetime - timedelta(days=1)