コード例 #1
0
 def test_NDaysBeforeLastTradingDayOfMonth(self, n):
     cal = get_calendar('NYSE')
     rule = NDaysBeforeLastTradingDayOfMonth(n)
     rule.cal = cal
     should_trigger = rule.should_trigger
     for n_days_before, d in enumerate(reversed(self.sept_days)):
         for m in self.nyse_cal.trading_minutes_for_day(d):
             if should_trigger(m):
                 self.assertEqual(n_days_before, n)
             else:
                 self.assertNotEqual(n_days_before, n)
コード例 #2
0
ファイル: test_events.py プロジェクト: 4ever911/zipline
 def test_NDaysBeforeLastTradingDayOfMonth(self, n):
     cal = get_calendar('NYSE')
     rule = NDaysBeforeLastTradingDayOfMonth(n)
     rule.cal = cal
     should_trigger = rule.should_trigger
     for n_days_before, session in enumerate(reversed(self.oct_sessions)):
         for m in self.nyse_cal.minutes_for_session(session):
             if should_trigger(m):
                 self.assertEqual(n_days_before, n)
             else:
                 self.assertNotEqual(n_days_before, n)
コード例 #3
0
ファイル: test_events.py プロジェクト: fangchenli/zipline
 def test_NDaysBeforeLastTradingDayOfMonth(self):
     for n in range(MAX_MONTH_RANGE):
         rule = NDaysBeforeLastTradingDayOfMonth(n)
         rule.cal = self.cal
         should_trigger = rule.should_trigger
         sessions = reversed(self.oct_sessions)
         for n_days_before, session in enumerate(sessions):
             for m in self.cal.minutes_for_session(session)[0:10]:
                 if should_trigger(m):
                     self.assertEqual(n_days_before, n)
                 else:
                     self.assertNotEqual(n_days_before, n)
コード例 #4
0
ファイル: test_events.py プロジェクト: barrygolden/zipline
 def test_NDaysBeforeLastTradingDayOfMonth(self):
     for n in range(MAX_MONTH_RANGE):
         rule = NDaysBeforeLastTradingDayOfMonth(n)
         rule.cal = self.cal
         should_trigger = rule.should_trigger
         sessions = reversed(self.oct_sessions)
         for n_days_before, session in enumerate(sessions):
             for m in self.cal.minutes_for_session(session)[0:10]:
                 if should_trigger(m):
                     self.assertEqual(n_days_before, n)
                 else:
                     self.assertNotEqual(n_days_before, n)
コード例 #5
0
ファイル: test_events.py プロジェクト: zhoulingjun/zipline
 def test_NDaysBeforeLastTradingDayOfMonth(self, n):
     should_trigger = NDaysBeforeLastTradingDayOfMonth(n).should_trigger
     for n_days_before, d in enumerate(reversed(self.sept_days)):
         for m in self.env.market_minutes_for_day(d):
             if should_trigger(m):
                 self.assertEqual(n_days_before, n)
             else:
                 self.assertNotEqual(n_days_before, n)