Пример #1
0
 def test__build_live_trading_timeline(self):
     now = dt.datetime.now(pytz.utc)
     for start in [None, now + pd.tseries.offsets.Minute(5)]:
         for end in [None, "2014/06/01"]:
             dates = utils.build_trading_timeline(start, end)
             self._validate_dates(dates)
             self.assertGreater(dates[0], now)
             self.assertGreater(dates[-1], now)
Пример #2
0
 def test__build_live_trading_timeline(self):
     now = dt.datetime.now(pytz.utc)
     for start in [None, now + pd.tseries.offsets.Minute(5)]:
         for end in [None, '2014/06/01']:
             dates = utils.build_trading_timeline(start, end)
             self._validate_dates(dates)
             self.assertGreater(dates[0], now)
             self.assertGreater(dates[-1], now)
Пример #3
0
 def test__build_hybrid_trading_timeline(self):
     now = dt.datetime.now(pytz.utc)
     start = "2014/01/01"
     end = "2014/06/01"
     dates = utils.build_trading_timeline(start, end)
     self._validate_dates(dates)
     eq_(dt.timedelta(days=1), dates[-1] - dates[-2])
     self.assertGreater(now, dates[0])
     self.assertGreater(dates[-1], now)
Пример #4
0
 def test__build_backtest_trading_timeline(self):
     for start in ["2012/01/01", None]:
         for end in ["2013/01/01", None]:
             if not start and not end:
                 # This is live trading on one day
                 continue
             dates = utils.build_trading_timeline(start, end)
             self._validate_dates(dates)
             eq_(pd.tseries.offsets.Day(1), dates.freq)
Пример #5
0
 def test__build_hybrid_trading_timeline(self):
     now = dt.datetime.now(pytz.utc)
     start = '2014/01/01'
     end = '2014/06/01'
     dates = utils.build_trading_timeline(start, end)
     self._validate_dates(dates)
     eq_(dt.timedelta(days=1), dates[-1] - dates[-2])
     self.assertGreater(now, dates[0])
     self.assertGreater(dates[-1], now)
Пример #6
0
 def test__build_backtest_trading_timeline(self):
     for start in ['2012/01/01', None]:
         for end in ['2013/01/01', None]:
             if not start and not end:
                 # This is live trading on one day
                 continue
             dates = utils.build_trading_timeline(start, end)
             self._validate_dates(dates)
             eq_(pd.tseries.offsets.Day(1), dates.freq)