Reputation: 307
I'm using zipline and trying to add a custom calendar to the system so that I can apply it to our country's exchange.
I've looked up on stackoverflow and found this post : How to use a custom calendar in a custom zipline bundle?
However, I couldn't find the directory zipline/utils/calendars mentioned on the post, in which I should find the calendar python files. It seems to be deprecated. So I'm currently lost on how I should tune the trading calendar on this zipline library in order to fulfill my needs. Any solutions, suggestions or links are welcomed.
Thank you in advance.
EDIT : I'm using python3.5 on mac, and the zipline version seems to be 1.3.0
Upvotes: 1
Views: 1917
Reputation: 87
but what about following code for data bundle? I assume there are some other places should be update than this calendar_name? the data bundle still can't import the data in.
register(
'custom-csvdir-bundle',
csvdir_equities(
['daily'],
r'C:\Users\csvdata',
),
calendar_name='XTSE',
start_session=start_session,
end_session=end_session
)
Upvotes: 0
Reputation: 92
In version 1.3.0 zipline uses trading_calendars module from quantopian. You have to install it via pip and then you can use it in your project:
from trading_calendars import get_calendar
trading_calendar=get_calendar('XNYS')
List of supported calendars you can find in github: trading_calendars
If you would like to create your own calendar, you have to create your calendar class in similar way like the old one which is described here: trading_calendars zipline documentation Then to use it, you need to register it with register_calendar()
. So in the end it should be similar to this:
from trading_calendars import get_calendar, register_calendar
from my_calendar import MyCalendar
register_calendar('MyCalendarName', MyCalendar, True)
trading_calendar=get_calendar('MyCalendarName')
Upvotes: 2