New Market or Exchange

To create a new exchange (or OTC market):

  1. Create a new class that inherits from MarketCalendar
  2. In the new class create the following class attributes (variables):
    1. aliases = […]
    2. open_time_default = datetime.time(…)
    3. close_time_default = datetime.time(…)
    4. regular_early_close = datetime.time(…)
  3. Define the following property methods:
    1. name
    2. tz (time zone)
  4. Now optionally define any of the following property methods:
    1. Break start and end:
      1. break_start - returns a time that the market start its break
      2. break_end - returns a time that the market ends the break
    2. Days where the market is fully closed:
      1. regular_holidays - returns an pandas AbstractHolidayCalendar object
      2. adhoc_holidays - returns a list of pandas Timestamp of a DatetimeIndex
    3. Days where the market closes early:
      1. special_closes - returns a list of tuples. The tuple is (datetime.time of close, AbstractHolidayCalendar)
      2. special_closes_adhoc - returns a list of tuples. The tuple is (datetime.time of close, list of date strings)
    4. Days where the market opens late:
      1. special_opens - returns a list of tuples. The tuple is (datetime.time of open, AbstractHolidayCalendar)
      2. special_opens_adhoc - returns a list of tuples. The tuple is (datetime.time of open, list of date strings)
  5. Import your new calendar class in calendar_registry.py:
from .exchange_calendar_xxx import XXXExchangeCalendar