rsheftel / pandas_market_calendars

Exchange calendars to use with pandas for trading applications
MIT License
775 stars 172 forks source link

24/7 Calendar is actually 24/5 #345

Closed jack-of-some-trades closed 2 months ago

jack-of-some-trades commented 2 months ago

Trying to implement this library into a Trading View like application. I'm looking to have capability to handle crypto markets in addition to others hence the need for the 24/7 Calendar. While testing stuff I ran into this fun little bug:

Screenshot 2024-06-07 185329

The weekend days, 07-07 & 07-08, are missing in that image. This boils down to the calendar adopting the default 5 Day Weekmask property of MarketCalendar (MarketCalendar.weekmask).

I dug into the code a bit to figure out what is going wrong. It turns out the 7 day week is correctly defined in "exchange_calendars > always_open.py" as weekmask = "1111111". The problem is this property is not transferred from the "AlwaysOpenCalendar" to the "24/7ExchangeCalendar" class that is actually used by the library.

pandas_market_calendars: Version 4.4.0 Python: Version 3.12.2

rsheftel commented 2 months ago

Fixed with v4.4.1

Thank you for the PR