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

Index out of bounds #203

Closed
Hammy27 opened this issue Dec 21, 2020 · 1 comment
Closed

Index out of bounds #203

Hammy27 opened this issue Dec 21, 2020 · 1 comment

Comments

@Hammy27
Copy link

Hammy27 commented Dec 21, 2020

When using this code:

import trading_calendars as tc
exchange = tc.get_calendar('XSWX')
exchange.next_open(pd.Timestamp('2021-12-27')

an index 8032 is out of bounds error for axis 0 with size 8032 is thrown.

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\raphael\anaconda3\envs\levine\lib\site-packages\trading_calendars\trading_calendar.py", line 462, in next_open
    idx = next_divider_idx(self.market_opens_nanos, dt.value)
  File "C:\Users\raphael\anaconda3\envs\levine\lib\site-packages\trading_calendars\calendar_helpers.py", line 12, in next_divider_idx
    target = dividers[divider_idx]
IndexError: index 8032 is out of bounds for axis 0 with size 8032

Seems to be a pandas Problem?

@gerrymanoim
Copy link
Collaborator

This is an artifact of https://github.com/quantopian/trading_calendars/blob/master/trading_calendars/trading_calendar.py#L47.

You can get around this via #147.

There was some discussion about making this process smoother via #176.

I think in the next year I'll work on some backwards incompatible features and put this enhancement in under a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants