def get_last_trading_day_of_month(self, dt, env):
self.month = dt.month
if dt.month == 12:
# Roll the year foward and start in January.
year = dt.year + 1
month = 1
else:
# Increment the month in the same year.
year = dt.year
month = dt.month + 1
self.last_day = env.previous_trading_day(
dt.replace(year=year, month=month, day=1)
).date()
return self.last_day
# Stateful rules
评论列表
文章目录