mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-18 12:20:12 +08:00
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:
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user