mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-09 11:19:23 +08:00
ENH: Changes the default offset for time_rules.market_open to 1, and
makes it an offset from 13:30 UTC. This is to be more consistent with the market_close, which is an offset from 20:00 UTC. This also makes market_open and market_close cache the dt to offset from for each day.
This commit is contained in:
@@ -260,9 +260,14 @@ class TestStatelessRules(RuleTestCase):
|
||||
def test_AfterOpen(self):
|
||||
should_trigger = AfterOpen(minutes=5, hours=1).should_trigger
|
||||
for d in self.trading_days:
|
||||
for m in islice(d, 65):
|
||||
for m in islice(d, 64):
|
||||
# Check the first 64 minutes of data.
|
||||
# We use 64 because the offset is from market open
|
||||
# at 13:30 UTC, meaning the first minute of data has an
|
||||
# offset of 1.
|
||||
self.assertFalse(should_trigger(m))
|
||||
for m in islice(d, 65, None):
|
||||
for m in islice(d, 64, None):
|
||||
# Check the rest of the day.
|
||||
self.assertTrue(should_trigger(m))
|
||||
|
||||
def test_BeforeClose(self):
|
||||
|
||||
Reference in New Issue
Block a user