def test_open_at_time():
cal = FakeCalendar()
schedule = cal.schedule('2014-01-01', '2016-12-31')
# regular trading day
assert cal.open_at_time(schedule, pd.Timestamp('2014-07-02 03:40', tz='UTC')) is True
# early close
assert cal.open_at_time(schedule, pd.Timestamp('2014-07-03 03:40', tz='UTC')) is False
# holiday
assert cal.open_at_time(schedule, pd.Timestamp('2014-12-25 03:30', tz='UTC')) is False
# last bar of the day defaults to False
assert cal.open_at_time(schedule, pd.Timestamp('2016-09-07 11:49', tz='Asia/Ulaanbaatar')) is False
# last bar of the day is True if include_close is True
assert cal.open_at_time(schedule, pd.Timestamp('2016-09-07 11:49', tz='Asia/Ulaanbaatar'),
include_close=True) is True
test_market_calendar.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录