Esempio n. 1
0
	def shift_backward(self, numPeriods):
		if self.periodicity == SECONDS:
			self.startDT = dt_subtract_seconds(self.startDT, numPeriods)
			self.endDT = dt_subtract_seconds(self.endDT, numPeriods)
		elif self.periodicity == MONTHS:
			self.startDT = dt_subtract_months(self.startDT, numPeriods)
			self.endDT = dt_subtract_months(self.endDT, numPeriods)
		elif self.periodicity == QUARTERS:
			self.startDT = dt_subtract_months(self.startDT, 3*numPeriods)
			self.endDT = dt_subtract_months(self.endDT, 3*numPeriods)
		elif self.periodicity == YEARS:
			self.startDT = dt_subtract_months(self.startDT, 12*numPeriods)
			self.endDT = dt_subtract_months(self.endDT, 12*numPeriods)
		else:
			raise NotImplementedError
Esempio n. 2
0
	def truncate_end(self, numPeriods):
		if self.periodicity == SECONDS:
			self.endDT = dt_subtract_seconds(self.endDT, numPeriods)
		elif self.periodicity == MONTHS:
			self.endDT = dt_subtract_months(self.endDT, numPeriods)
		elif self.periodicity == QUARTERS:
			self.endDT = dt_subtract_months(self.endDT, 3*numPeriods)
		elif self.periodicity == YEARS:
			self.endDT = dt_subtract_months(self.endDT, 12*numPeriods)
		else:
			raise NotImplementedError