def test_next_event_indexer(self): events = self.events event_sids = events['sid'].values event_dates = events['event_date'].values event_timestamps = events['timestamp'].values all_dates = pd.date_range('2014', '2014-01-31') all_sids = np.unique(event_sids) indexer = next_event_indexer( all_dates, all_sids, event_dates, event_timestamps, event_sids, ) # Compute expected results without knowledge of null events. for i, sid in enumerate(all_sids): self.check_next_event_indexer( events, all_dates, sid, indexer[:, i], )
def test_next_event_indexer(self): events = self.events event_sids = events['sid'].values event_dates = events['event_date'] event_timestamps = events['timestamp'] all_dates = pd.date_range('2014', '2014-01-31', tz='UTC') all_sids = np.unique(event_sids) domain = EquitySessionDomain( all_dates, 'US', time(8, 45, tzinfo=pytz.timezone('US/Eastern')), ) indexer = next_event_indexer( all_dates, domain.data_query_cutoff_for_sessions(all_dates), all_sids, event_dates, event_timestamps, event_sids, ) # Compute expected results without knowledge of null events. for i, sid in enumerate(all_sids): self.check_next_event_indexer( events, all_dates, sid, indexer[:, i], )
def test_next_event_indexer(self): events = self.events event_sids = events['sid'].values event_dates = events['event_date'].values event_timestamps = events['timestamp'].values all_dates = pd.date_range('2014', '2014-01-31', tz='UTC') all_sids = np.unique(event_sids) domain = EquitySessionDomain( all_dates, 'US', time(8, 45, tzinfo=pytz.timezone('US/Eastern')), ) indexer = next_event_indexer( all_dates, domain.data_query_cutoff_for_sessions(all_dates), all_sids, event_dates, event_timestamps, event_sids, ) # Compute expected results without knowledge of null events. for i, sid in enumerate(all_sids): self.check_next_event_indexer( events, all_dates, sid, indexer[:, i], )
def test_next_event_indexer(self): events = self.events event_sids = events["sid"].to_numpy() event_dates = events["event_date"].to_numpy() event_timestamps = events["timestamp"].to_numpy() all_dates = pd.date_range("2014", "2014-01-31", tz="UTC") all_sids = np.unique(event_sids) domain = EquitySessionDomain( all_dates, "US", time(8, 45, tzinfo=pytz.timezone("US/Eastern")), ) indexer = next_event_indexer( all_dates, domain.data_query_cutoff_for_sessions(all_dates), all_sids, event_dates, event_timestamps, event_sids, ) # Compute expected results without knowledge of null events. for i, sid in enumerate(all_sids): self.check_next_event_indexer( events, all_dates, sid, indexer[:, i], )
def next_event_indexer(self, dates, sids): return next_event_indexer( dates, sids, self.events[EVENT_DATE_FIELD_NAME], self.events[TS_FIELD_NAME], self.events[SID_FIELD_NAME], )