def _monthly_range(self, last_day_of_month):
"""
Returns DatetimeIndex for monthly values.
"""
ldom = last_day_of_month
max_bars = 299
utcnow = datetime.utcnow()
dtm = pd.DatetimeIndex([])
while ldom < utcnow:
dtm = dtm.append(pd.date_range(
str(ldom), str(ldom)))
if ldom.month == 12:
ldom = ldom.replace(year=ldom.year+1, month=2, day=1)
elif ldom.month == 11:
ldom = ldom.replace(year=ldom.year+1, month=1, day=1)
else:
ldom = ldom.replace(month=ldom.month+2, day=1)
ldom -= timedelta(days=1)
ldom = ldom.replace(hour=self.new_york_offset(ldom, 22))
return dtm
评论列表
文章目录