Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
BUG/ENH: Allow users to switch between calendars #1800
You previously could not switch between different calendars because the
changed the title from
BUG: Allow users to switch between calendars
BUG/ENH: Allow users to switch between calendars
May 26, 2017
referenced this pull request
Sep 13, 2017
2 similar comments
This is a great change! Had some questions and suggestions for you.
Regarding tests, from what I can tell we don't have much for the CLI or
run_algorithm. I do see one call to
run_algorithm, so we at least get some coverage there of threading the new arg.
1 similar comment
1 similar comment
Oct 5, 2017
Hi @freddiev4 ,
I am new to zipline. I am trying to use a 24/7 calendar, so I am trying to use the feature of this PR already to do it in a proper way. I am using zipline installed via pip directly from github's egg (`pip install git+git://github.com/quantopian/zipline')
Unfortunately I am not able to use this feature properly, here is what I am doing:
I edited the
# A bunch of imports removed for the sake of clarity class TwentyFourSevenCalendar(TradingCalendar): """ Exchange calendar for 24/7 trading. Open Time: 12am, UTC Close Time: 11:59pm, UTC """ @property def name(self): return "TWENTYFOURSEVEN" @property def tz(self): return timezone("UTC") @property def open_time(self): return time(0, 0) @property def close_time(self): return time(23,59) @lazyval def day(self): return CustomBusinessDay( weekmask='Mon Tue Wed Thu Fri Sat Sun', ) start_session = pd.Timestamp('2014-01-07', tz='utc') end_session = pd.Timestamp('2017-11-13', tz='utc') assets = ['BTC_USD'] register_calendar( 'TWENTYFOURSEVEN', TwentyFourSevenCalendar( start=start_session, end=end_session ) ) register( 'custom-csvdir-bundle', csvdir_equities(["daily"], '/home/av/repos/ziplinetest/csvdir'), calendar_name='TWENTYFOURSEVEN', start_session=start_session, end_session=end_session )
As you can see I am using csvdir bundle which has recently been merged. The ingestion process seems to work fine (no errors and I also verified the directory and the sqlite files exist, so I assume the ingestion is ok). I conclude therefore that the 24/7 calendar works properly during ingestion.
When I try to execute with:
zipline run -f csvdir_example.py \ -b custom-csvdir-bundle \ --start 2016-1-1 \ --end 2017-1-1 \ --data-frequency daily \ --trading-calendar TWENTYFOURSEVEN \ --capital-base 100000 \ -o csvdir_example.pickle
Could you please help me?
Thanks a lot.