-
Notifications
You must be signed in to change notification settings - Fork 0
/
exchange_calendar_sse.py
54 lines (42 loc) · 1.24 KB
/
exchange_calendar_sse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from datetime import time
from itertools import chain
from pandas.tslib import Timestamp
from pytz import timezone
from zipline.utils.calendars import TradingCalendar
from zipline.utils.calendars.trading_calendar import HolidayCalendar
from zipline.utils.calendars.us_holidays import (
USNewYearsDay,
)
class SSEExchangeCalendar(TradingCalendar):
"""
Exchange calendar for Shanghai Stock Exchange.
Open Time: 9:30am, Asia/Shanghai
Close Time: 3:00pm, Asia/Shanghai
https://www.theice.com/publicdocs/futures_us/ICE_Futures_US_Regular_Trading_Hours.pdf # noqa
"""
@property
def name(self):
return "SSE"
@property
def tz(self):
return timezone("Asia/Shanghai")
@property
def open_time(self):
return time(9, 30)
@property
def close_time(self):
return time(15)
@property
def open_offset(self):
return -1
@property
def adhoc_holidays(self):
return list(chain(
[Timestamp('2012-10-29', tz='UTC')]
))
@property
def regular_holidays(self):
# https://www.theice.com/publicdocs/futures_us/exchange_notices/NewExNot2016Holidays.pdf # noqa
return HolidayCalendar([
USNewYearsDay,
])