def run(self): dates = DateUtils.nyse_dates_event(self.date, self.lookback_days, self.lookforward_days, self.estimation_period) start_date = dates[0] end_date = dates[-1] # Data to the General market_return Study self.data = self.data_access.get_data(self.symbol, start_date, end_date, self.field) evt_window_dates = dates[- self.lookforward_days - self.lookback_days - 1:] self.evt_window_data = self.data[evt_window_dates[0]:dates[-1]] self.market = self.data_access.get_data(self.market, start_date, end_date, self.field) # Parameters of the General market_return Study self.start_period = dates[0] self.end_period = dates[self.estimation_period] self.start_window = dates[self.estimation_period] self.end_window = dates[-1] # Run the Market Return method super().market_return()
def run(self): dates = DateUtils.nyse_dates_event(self.date, self.lookback_days, self.lookforward_days, self.estimation_period) start_date = dates[0] end_date = dates[-1] # Data to the General market_return Study self.data = self.data_access.get_data(self.symbol, start_date, end_date, self.field) evt_window_dates = dates[-self.lookforward_days - self.lookback_days - 1:] self.evt_window_data = self.data[evt_window_dates[0]:dates[-1]] self.market = self.data_access.get_data(self.market, start_date, end_date, self.field) # Parameters of the General market_return Study self.start_period = dates[0] self.end_period = dates[self.estimation_period] self.start_window = dates[self.estimation_period] self.end_window = dates[-1] # Run the Market Return method super().market_return()
def nyse_dates_event(self): dates = DateUtils.nyse_dates_event(datetime(2009, 1, 5), 10, 10, 250) self.assertEquals(dates[0], datetime(2007, 12, 21)) self.assertEquals(dates[-1], datetime(2009, 1, 20)) self.assertEquals(len(dates), 271)