Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to change start_default/end_default in trading_calendars #147

Open
leonarduschen opened this issue Sep 2, 2020 · 3 comments · May be fixed by #176
Open

Allow users to change start_default/end_default in trading_calendars #147

leonarduschen opened this issue Sep 2, 2020 · 3 comments · May be fixed by #176
Labels
enhancement New feature or request

Comments

@leonarduschen
Copy link
Contributor

Related to the issue: quantopian/zipline#2700

As @richafrank mentioned on the issue linked above is the module-level variable start_default in trading_calendars\trading_calendar.py being '1990-01-01'.

In my opinion '1990-01-01' seems somewhat arbitrary. As far as my understanding goes, the only reason it is '1990-01-01' and not earlier is to avoid caches to take up too much memory.

Disadvantages of this approach:

  • The open-issue linked above
  • PrecomputedTradingCalendar uses its own start/end dates and some of them start earlier than '1990-01-01'
  • The cached data frame does not take that much memory anyway? (but I might be utterly wrong here)

Possible solutions off the top of my head:

  • Change 'start_default' to something much earlier
  • Add exchange specific start_default and end_default, this is consistent with how PrecomputedTradingCalendar behaves
  • Add a way for end-user to change start_default and end_default (e.g. store start_default and end_default in a mutable container than give access to end-user).
@leonarduschen leonarduschen changed the title (SUGGESTION) Consider changing start_default in trading_calendars Consider changing start_default in trading_calendars Sep 2, 2020
@gerrymanoim
Copy link
Collaborator

Thanks for opening this - let me do some digging.

@Laurentvw
Copy link

I second this. Let me add some weight to this.

I am using some assets that go as far back as the 1870s. The get_calendar() utility method currently doesn't allow me to set an earlier default date.

So I resort to doing something like this:

from trading_calendars.exchange_calendar_xams import XAMSExchangeCalendar
start = pd.Timestamp(from_date, tz=pytz.UTC)
tcal = XAMSExchangeCalendar(start=start)

Having a way to change the default dates from the get_calendar() utility would come in handy.

@gerrymanoim gerrymanoim added the enhancement New feature or request label Oct 10, 2020
@gerrymanoim
Copy link
Collaborator

Cool to hear you're working with asset data that goes back that far!

I think passing an optional start date param via get_calendar makes sense to me, rather than messing with the defaults. @richafrank - what do you think?

@gerrymanoim gerrymanoim changed the title Consider changing start_default in trading_calendars Allow users to change start_default/end_default in trading_calendars Oct 13, 2020
beppe712 pushed a commit to AlpacaTechJP/trading_calendars that referenced this issue Dec 26, 2022
…9_XSHG

Added public holidays before 1999 in XSHG.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants