BUG: Fix environment minute date range start and volume.

The bar timestamps for day start and finish, for NYSE traded stocks,
should be 9:31 AM EST to 4:00 PM EST, for a total of 390 minutes.

Fix starting at 9:30 AM and the creation of 391 bars.
This commit is contained in:
Eddie Hebert
2013-04-15 16:35:41 -04:00
parent 9099d301f3
commit 4ff49749d7
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ class AlgorithmGeneratorTestCase(TestCase):
# May 7, 2012 was an LSE holiday, confirm the 4th trading
# day was May 8.
self.assertEqual(results[4]['daily_perf']['period_open'],
datetime(2012, 5, 8, 8, 30, tzinfo=pytz.utc))
datetime(2012, 5, 8, 8, 31, tzinfo=pytz.utc))
@timed(DEFAULT_TIMEOUT)
def test_generator_dates(self):
+1 -1
View File
@@ -72,7 +72,7 @@ class TestDividendPerformance(unittest.TestCase):
def test_market_hours_calculations(self):
with trading.TradingEnvironment():
# DST in US/Eastern began on Sunday March 14, 2010
before = datetime.datetime(2010, 3, 12, 14, 30, tzinfo=pytz.utc)
before = datetime.datetime(2010, 3, 12, 14, 31, tzinfo=pytz.utc)
after = factory.get_next_trading_dt(
before,
datetime.timedelta(days=1)
+4 -2
View File
@@ -187,7 +187,7 @@ Last successful date: %s" % self.market_open)
# shift the time between EST and UTC.
next_open = next_open.replace(
hour=9,
minute=30,
minute=31,
second=0,
microsecond=0,
tzinfo=None
@@ -197,7 +197,9 @@ Last successful date: %s" % self.market_open)
open_utc = self.exchange_dt_in_utc(next_open)
market_open = open_utc
market_close = market_open + self.get_trading_day_duration(open_utc)
market_close = (market_open
+ self.get_trading_day_duration(open_utc)
- datetime.timedelta(minutes=1))
return market_open, market_close