tradinghours.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:fxcmminer 作者: JamesKBowler 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号