def testWithTimezone(self): timeZone = marketsession.USEquities.getTimezone() bar_feed = self.__loadIntradayBarFeed(timeZone) ds = bar_feed.get_data_series() for i in xrange(ds.get_length()): current_bar = ds[i] self.assertFalse(dt.datetime_is_naive(current_bar.get_date_time()))
def testWithoutTimezone(self): bar_feed = self.__loadIntradayBarFeed(None) ds = bar_feed.get_data_series() for i in xrange(ds.get_length()): current_bar = ds[i] # Datetime must be set to UTC. self.assertFalse(dt.datetime_is_naive(current_bar.get_date_time()))
def testWithPerFileTimezone(self): bar_feed = yahoofeed.Feed() bar_feed.add_bars_from_csv(YahooTestCase.TestInstrument, common.get_data_file_path("orcl-2000-yahoofinance.csv"), marketsession.USEquities.getTimezone()) bar_feed.add_bars_from_csv(YahooTestCase.TestInstrument, common.get_data_file_path("orcl-2001-yahoofinance.csv"), marketsession.USEquities.getTimezone()) bar_feed.start() for bars in bar_feed: bar = bars.get_bar(YahooTestCase.TestInstrument) self.assertFalse(dt.datetime_is_naive(bar.get_date_time())) bar_feed.stop() bar_feed.join()