rsheftel/pandas_market_calendars

Inconsistent use of time zones

rdong8 opened this issue · 3 comments

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=[

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 commented

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)),),
    }

Yes