Skip to content

Commit

Permalink
add timezone to the open and close time for trading-calendars
Browse files Browse the repository at this point in the history
  • Loading branch information
rsheftel committed Sep 13, 2020
1 parent 0037d96 commit 25cf7c5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,11 @@ Future
------
This package is open sourced under the MIT license. Everyone is welcome to add more exchanges or OTC markets, confirm
or correct the existing calendars, and generally do whatever they desire with this code.

Merger with Quantopian Trading-Calendars
========================================
Work has begun to merge this project with the quantopian trading-calendars project that it was originally forked from.
The end-state is to have one unified project that brings together the superset of all funcationality in this project
and trading-calendars, and to have one source for all market calendars.

The process of this merger will be updated in #120, everyone is welcome to comment or provide their input
7 changes: 7 additions & 0 deletions docs/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ Change Log

Updates
-------
1.6 (9/14/20)
~~~~~~~~~~~~~
This is the first version of the merge of this project with the quantopian trading-calendars.
- Added the trading_calendars.py module that brings in all current and future calendars from the quantopian project.
- All calendars from trading-calendars are now available in pandas_market_calendars


1.5 (8/30/20)
~~~~~~~~~~~~~
- Add the is_open_now() function
Expand Down
6 changes: 3 additions & 3 deletions pandas_market_calendars/trading_calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class TradingCalendar(MarketCalendar):
def __init__(self, open_time=None, close_time=None):
self._tc = self._tc_class() # _tc.class is defined in the class generator below
self._tc = self._tc_class() # noqa: _tc.class is defined in the class generator below
super().__init__(open_time, close_time)

@property
Expand All @@ -27,11 +27,11 @@ def tz(self):
@property
def open_time_default(self):
tc_time = self._tc.open_times[0][1]
return time(tc_time.hour, max(tc_time.minute - 1, 0)) # aligns the open time standard with mcal
return time(tc_time.hour, max(tc_time.minute - 1, 0), tzinfo=self.tz) # aligns the open time standard with mcal

@property
def close_time_default(self):
return self._tc.close_times[0][1]
return self._tc.close_times[0][1].replace(tzinfo=self.tz)

@property
def regular_holidays(self):
Expand Down

0 comments on commit 25cf7c5

Please sign in to comment.