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

Inconsistent use of time zones #260

Open
rdong8 opened this issue Jun 10, 2023 · 3 comments
Open

Inconsistent use of time zones #260

rdong8 opened this issue Jun 10, 2023 · 3 comments

Comments

@rdong8
Copy link

rdong8 commented Jun 10, 2023

For instance, for the CME energy and metals class, we have no time zone supplied here:

"market_open": ((None, time(17), -1),), #Sunday offset. Central Timezone (CT)

But it is used here:

(time(12, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[

(time(12, 45, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[

(time(13, 30, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[

@rsheftel
Copy link
Owner

rsheftel commented Sep 6, 2023

Agree that this should be cleaned up for visual consistency. As a practical matter there is a .tz method on every calendar that defines the default time zone. If you would like to submit a PR that would be great.

@rdong8
Copy link
Author

rdong8 commented Sep 6, 2023

tz must be defined before we refer to it, so is it ok to move all the definitions of the tz property right above the definition of regular_market_times?

class CMEGlobexEquitiesExchangeCalendar(CMEGlobexBaseExchangeCalendar):

    aliases = ["CME Globex Equity"]

    @property
    def tz(self): return timezone("America/Chicago")

    regular_market_times = {
        "market_open": ((None, time(17), -1),), # offset by -1 day
        "market_close": ((None, time(16)),),
    }

@rsheftel
Copy link
Owner

rsheftel commented Sep 6, 2023

Yes

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