pandas-market-calendars 5.1.0__py3-none-any.whl → 5.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pandas_market_calendars/__init__.py +39 -39
 - pandas_market_calendars/calendar_registry.py +58 -57
 - pandas_market_calendars/calendar_utils.py +1151 -1151
 - pandas_market_calendars/calendars/asx.py +100 -70
 - pandas_market_calendars/calendars/bmf.py +225 -219
 - pandas_market_calendars/calendars/bse.py +433 -425
 - pandas_market_calendars/calendars/cboe.py +153 -149
 - pandas_market_calendars/calendars/cme.py +417 -405
 - pandas_market_calendars/calendars/cme_globex_agriculture.py +172 -172
 - pandas_market_calendars/calendars/cme_globex_base.py +127 -119
 - pandas_market_calendars/calendars/cme_globex_crypto.py +166 -158
 - pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +224 -216
 - pandas_market_calendars/calendars/cme_globex_equities.py +131 -123
 - pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -136
 - pandas_market_calendars/calendars/cme_globex_fx.py +101 -101
 - pandas_market_calendars/calendars/eurex.py +139 -131
 - pandas_market_calendars/calendars/eurex_fixed_income.py +106 -98
 - pandas_market_calendars/calendars/hkex.py +437 -431
 - pandas_market_calendars/calendars/ice.py +89 -81
 - pandas_market_calendars/calendars/iex.py +163 -155
 - pandas_market_calendars/calendars/jpx.py +125 -117
 - pandas_market_calendars/calendars/lse.py +126 -118
 - pandas_market_calendars/calendars/mirror.py +144 -144
 - pandas_market_calendars/calendars/nyse.py +1462 -1466
 - pandas_market_calendars/calendars/ose.py +124 -118
 - pandas_market_calendars/calendars/sifma.py +391 -383
 - pandas_market_calendars/calendars/six.py +144 -136
 - pandas_market_calendars/calendars/sse.py +305 -315
 - pandas_market_calendars/calendars/tase.py +232 -224
 - pandas_market_calendars/calendars/tsx.py +193 -185
 - pandas_market_calendars/class_registry.py +115 -115
 - pandas_market_calendars/holidays/cme.py +385 -385
 - pandas_market_calendars/holidays/cme_globex.py +214 -214
 - pandas_market_calendars/holidays/cn.py +1476 -1476
 - pandas_market_calendars/holidays/jp.py +401 -401
 - pandas_market_calendars/holidays/jpx_equinox.py +506 -506
 - pandas_market_calendars/holidays/nyse.py +1536 -1536
 - pandas_market_calendars/holidays/oz.py +82 -63
 - pandas_market_calendars/holidays/sifma.py +350 -350
 - pandas_market_calendars/holidays/uk.py +186 -186
 - pandas_market_calendars/holidays/us.py +376 -376
 - pandas_market_calendars/market_calendar.py +1006 -1008
 - {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.3.dist-info}/METADATA +5 -4
 - pandas_market_calendars-5.1.3.dist-info/RECORD +50 -0
 - {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.3.dist-info}/WHEEL +1 -1
 - pandas_market_calendars-5.1.0.dist-info/RECORD +0 -50
 - {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.3.dist-info}/licenses/LICENSE +0 -0
 - {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.3.dist-info}/licenses/NOTICE +0 -0
 - {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.3.dist-info}/top_level.txt +0 -0
 
| 
         @@ -1,117 +1,125 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            from datetime import time
         
     | 
| 
       2 
     | 
    
         
            -
            from itertools import chain
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            from pandas.tseries.holiday import AbstractHolidayCalendar
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            #  
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                 
     | 
| 
       28 
     | 
    
         
            -
                 
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                 
     | 
| 
       32 
     | 
    
         
            -
                 
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                 
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                 
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                     
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                 
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                @property
         
     | 
| 
       49 
     | 
    
         
            -
                def  
     | 
| 
       50 
     | 
    
         
            -
                    return  
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                @property
         
     | 
| 
       53 
     | 
    
         
            -
                def  
     | 
| 
       54 
     | 
    
         
            -
                    return  
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                             
     | 
| 
       79 
     | 
    
         
            -
                             
     | 
| 
       80 
     | 
    
         
            -
                             
     | 
| 
       81 
     | 
    
         
            -
                             
     | 
| 
       82 
     | 
    
         
            -
                             
     | 
| 
       83 
     | 
    
         
            -
                             
     | 
| 
       84 
     | 
    
         
            -
                             
     | 
| 
       85 
     | 
    
         
            -
                             
     | 
| 
       86 
     | 
    
         
            -
                             
     | 
| 
       87 
     | 
    
         
            -
                             
     | 
| 
       88 
     | 
    
         
            -
                             
     | 
| 
       89 
     | 
    
         
            -
                             
     | 
| 
       90 
     | 
    
         
            -
                             
     | 
| 
       91 
     | 
    
         
            -
                             
     | 
| 
       92 
     | 
    
         
            -
                             
     | 
| 
       93 
     | 
    
         
            -
                             
     | 
| 
       94 
     | 
    
         
            -
                             
     | 
| 
       95 
     | 
    
         
            -
                             
     | 
| 
       96 
     | 
    
         
            -
                             
     | 
| 
       97 
     | 
    
         
            -
                             
     | 
| 
       98 
     | 
    
         
            -
                             
     | 
| 
       99 
     | 
    
         
            -
                             
     | 
| 
       100 
     | 
    
         
            -
                             
     | 
| 
       101 
     | 
    
         
            -
                             
     | 
| 
       102 
     | 
    
         
            -
                             
     | 
| 
       103 
     | 
    
         
            -
                             
     | 
| 
       104 
     | 
    
         
            -
                             
     | 
| 
       105 
     | 
    
         
            -
                             
     | 
| 
       106 
     | 
    
         
            -
                             
     | 
| 
       107 
     | 
    
         
            -
                             
     | 
| 
       108 
     | 
    
         
            -
                             
     | 
| 
       109 
     | 
    
         
            -
                             
     | 
| 
       110 
     | 
    
         
            -
                             
     | 
| 
       111 
     | 
    
         
            -
                             
     | 
| 
       112 
     | 
    
         
            -
                             
     | 
| 
       113 
     | 
    
         
            -
                             
     | 
| 
       114 
     | 
    
         
            -
                             
     | 
| 
       115 
     | 
    
         
            -
                             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            from datetime import time
         
     | 
| 
      
 2 
     | 
    
         
            +
            from itertools import chain
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            from pandas.tseries.holiday import AbstractHolidayCalendar
         
     | 
| 
      
 5 
     | 
    
         
            +
            import sys
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # check python versiOn aNd import accordingly
         
     | 
| 
      
 8 
     | 
    
         
            +
            if sys.version_info >= (3, 9):
         
     | 
| 
      
 9 
     | 
    
         
            +
                # For Python 3.9 and later, import directly
         
     | 
| 
      
 10 
     | 
    
         
            +
                from zoneinfo import ZoneInfo
         
     | 
| 
      
 11 
     | 
    
         
            +
            else:
         
     | 
| 
      
 12 
     | 
    
         
            +
                # For Python 3.8 and earlier, import from backports
         
     | 
| 
      
 13 
     | 
    
         
            +
                from backports.zoneinfo import ZoneInfo
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            from pandas_market_calendars.holidays.jp import *
         
     | 
| 
      
 16 
     | 
    
         
            +
            from pandas_market_calendars.holidays.us import USNewYearsDay
         
     | 
| 
      
 17 
     | 
    
         
            +
            from pandas_market_calendars.market_calendar import MarketCalendar
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            # TODO:
         
     | 
| 
      
 21 
     | 
    
         
            +
            # From 1949 to 1972 the TSE was open on all non-holiday Saturdays for a half day
         
     | 
| 
      
 22 
     | 
    
         
            +
            # From 1973 to 1984 the TSE was open on all non-holiday Saturdays except the third Saturday of the month
         
     | 
| 
      
 23 
     | 
    
         
            +
            # need to add support for weekmask to make this work properly
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            class JPXExchangeCalendar(MarketCalendar):
         
     | 
| 
      
 27 
     | 
    
         
            +
                """
         
     | 
| 
      
 28 
     | 
    
         
            +
                Exchange calendar for JPX
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                Open Time: 9:31 AM, Asia/Tokyo
         
     | 
| 
      
 31 
     | 
    
         
            +
                LUNCH BREAK :facepalm: : 11:30 AM - 12:30 PM Asia/Tokyo
         
     | 
| 
      
 32 
     | 
    
         
            +
                Close Time: 3:30 PM, Asia/Tokyo
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                Market close of Japan changed from 3:00 PM to 3:30 PM on November 5, 2024
         
     | 
| 
      
 35 
     | 
    
         
            +
                Reference:
         
     | 
| 
      
 36 
     | 
    
         
            +
                https://www.jpx.co.jp/english/equities/trading/domestic/tvdivq0000006blj-att/tradinghours_eg.pdf
         
     | 
| 
      
 37 
     | 
    
         
            +
                """
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                aliases = ["JPX", "XJPX"]
         
     | 
| 
      
 40 
     | 
    
         
            +
                regular_market_times = {
         
     | 
| 
      
 41 
     | 
    
         
            +
                    "market_open": ((None, time(9)),),
         
     | 
| 
      
 42 
     | 
    
         
            +
                    "market_close": ((None, time(15)), ("2024-11-05", time(15, 30))),
         
     | 
| 
      
 43 
     | 
    
         
            +
                    "break_start": ((None, time(11, 30)),),
         
     | 
| 
      
 44 
     | 
    
         
            +
                    "break_end": ((None, time(12, 30)),),
         
     | 
| 
      
 45 
     | 
    
         
            +
                }
         
     | 
| 
      
 46 
     | 
    
         
            +
                regular_early_close = time(13)
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                @property
         
     | 
| 
      
 49 
     | 
    
         
            +
                def name(self):
         
     | 
| 
      
 50 
     | 
    
         
            +
                    return "JPX"
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                @property
         
     | 
| 
      
 53 
     | 
    
         
            +
                def full_name(self):
         
     | 
| 
      
 54 
     | 
    
         
            +
                    return "Japan Exchange Group"
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                @property
         
     | 
| 
      
 57 
     | 
    
         
            +
                def tz(self):
         
     | 
| 
      
 58 
     | 
    
         
            +
                    return ZoneInfo("Asia/Tokyo")
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                @property
         
     | 
| 
      
 61 
     | 
    
         
            +
                def adhoc_holidays(self):
         
     | 
| 
      
 62 
     | 
    
         
            +
                    return list(
         
     | 
| 
      
 63 
     | 
    
         
            +
                        chain(
         
     | 
| 
      
 64 
     | 
    
         
            +
                            AscensionDays,
         
     | 
| 
      
 65 
     | 
    
         
            +
                            MarriageDays,
         
     | 
| 
      
 66 
     | 
    
         
            +
                            FuneralShowa,
         
     | 
| 
      
 67 
     | 
    
         
            +
                            EnthronementDays,
         
     | 
| 
      
 68 
     | 
    
         
            +
                            AutumnalCitizenDates,
         
     | 
| 
      
 69 
     | 
    
         
            +
                            NoN225IndexPrices,
         
     | 
| 
      
 70 
     | 
    
         
            +
                            EquityTradingSystemFailure,
         
     | 
| 
      
 71 
     | 
    
         
            +
                        )
         
     | 
| 
      
 72 
     | 
    
         
            +
                    )
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                @property
         
     | 
| 
      
 75 
     | 
    
         
            +
                def regular_holidays(self):
         
     | 
| 
      
 76 
     | 
    
         
            +
                    return AbstractHolidayCalendar(
         
     | 
| 
      
 77 
     | 
    
         
            +
                        rules=[
         
     | 
| 
      
 78 
     | 
    
         
            +
                            USNewYearsDay,
         
     | 
| 
      
 79 
     | 
    
         
            +
                            JapanNewYearsDay2,
         
     | 
| 
      
 80 
     | 
    
         
            +
                            JapanNewYearsDay3,
         
     | 
| 
      
 81 
     | 
    
         
            +
                            JapanComingOfAgeDay1951To1973,
         
     | 
| 
      
 82 
     | 
    
         
            +
                            JapanComingOfAgeDay1974To1999,
         
     | 
| 
      
 83 
     | 
    
         
            +
                            JapanComingOfAgeDay,
         
     | 
| 
      
 84 
     | 
    
         
            +
                            JapanNationalFoundationDay1969To1973,
         
     | 
| 
      
 85 
     | 
    
         
            +
                            JapanNationalFoundationDay,
         
     | 
| 
      
 86 
     | 
    
         
            +
                            JapanEmperorsBirthday,
         
     | 
| 
      
 87 
     | 
    
         
            +
                            JapanVernalEquinox,
         
     | 
| 
      
 88 
     | 
    
         
            +
                            JapanShowaDayUntil1972,
         
     | 
| 
      
 89 
     | 
    
         
            +
                            JapanShowaDay,
         
     | 
| 
      
 90 
     | 
    
         
            +
                            JapanConstitutionMemorialDayUntil1972,
         
     | 
| 
      
 91 
     | 
    
         
            +
                            JapanConstitutionMemorialDay,
         
     | 
| 
      
 92 
     | 
    
         
            +
                            JapanGreeneryDay,
         
     | 
| 
      
 93 
     | 
    
         
            +
                            JapanChildrensDayUntil1972,
         
     | 
| 
      
 94 
     | 
    
         
            +
                            JapanChildrensDay,
         
     | 
| 
      
 95 
     | 
    
         
            +
                            JapanGoldenWeekBonusDay,
         
     | 
| 
      
 96 
     | 
    
         
            +
                            JapanMarineDay1996To2002,
         
     | 
| 
      
 97 
     | 
    
         
            +
                            JapanMarineDay2003To2019,
         
     | 
| 
      
 98 
     | 
    
         
            +
                            JapanMarineDay2020,
         
     | 
| 
      
 99 
     | 
    
         
            +
                            JapanMarineDay2021,
         
     | 
| 
      
 100 
     | 
    
         
            +
                            JapanMarineDay,
         
     | 
| 
      
 101 
     | 
    
         
            +
                            JapanMountainDay2016to2019,
         
     | 
| 
      
 102 
     | 
    
         
            +
                            JapanMountainDay2020,
         
     | 
| 
      
 103 
     | 
    
         
            +
                            JapanMountainDay2021,
         
     | 
| 
      
 104 
     | 
    
         
            +
                            JapanMountainDay2021NextDay,
         
     | 
| 
      
 105 
     | 
    
         
            +
                            JapanMountainDay,
         
     | 
| 
      
 106 
     | 
    
         
            +
                            JapanRespectForTheAgedDay1966To1972,
         
     | 
| 
      
 107 
     | 
    
         
            +
                            JapanRespectForTheAgedDay1973To2002,
         
     | 
| 
      
 108 
     | 
    
         
            +
                            JapanRespectForTheAgedDay,
         
     | 
| 
      
 109 
     | 
    
         
            +
                            JapanAutumnalEquinox,
         
     | 
| 
      
 110 
     | 
    
         
            +
                            JapanHealthAndSportsDay1966To1972,
         
     | 
| 
      
 111 
     | 
    
         
            +
                            JapanHealthAndSportsDay1973To1999,
         
     | 
| 
      
 112 
     | 
    
         
            +
                            JapanHealthAndSportsDay2000To2019,
         
     | 
| 
      
 113 
     | 
    
         
            +
                            JapanSportsDay2020,
         
     | 
| 
      
 114 
     | 
    
         
            +
                            JapanSportsDay2021,
         
     | 
| 
      
 115 
     | 
    
         
            +
                            JapanSportsDay,
         
     | 
| 
      
 116 
     | 
    
         
            +
                            JapanCultureDayUntil1972,
         
     | 
| 
      
 117 
     | 
    
         
            +
                            JapanCultureDay,
         
     | 
| 
      
 118 
     | 
    
         
            +
                            JapanLaborThanksgivingDayUntil1972,
         
     | 
| 
      
 119 
     | 
    
         
            +
                            JapanLaborThanksgivingDay,
         
     | 
| 
      
 120 
     | 
    
         
            +
                            JapanEmperorAkahitosBirthday,
         
     | 
| 
      
 121 
     | 
    
         
            +
                            JapanDecember29Until1988,
         
     | 
| 
      
 122 
     | 
    
         
            +
                            JapanDecember30Until1988,
         
     | 
| 
      
 123 
     | 
    
         
            +
                            JapanBeforeNewYearsDay,
         
     | 
| 
      
 124 
     | 
    
         
            +
                        ]
         
     | 
| 
      
 125 
     | 
    
         
            +
                    )
         
     | 
| 
         @@ -1,118 +1,126 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright 2016 Quantopian, Inc.
         
     | 
| 
       3 
     | 
    
         
            -
            #
         
     | 
| 
       4 
     | 
    
         
            -
            # Licensed under the Apache License, Version 2.0 (the "License");
         
     | 
| 
       5 
     | 
    
         
            -
            # you may not use this file except in compliance with the License.
         
     | 
| 
       6 
     | 
    
         
            -
            # You may obtain a copy of the License at
         
     | 
| 
       7 
     | 
    
         
            -
            #
         
     | 
| 
       8 
     | 
    
         
            -
            #     http://www.apache.org/licenses/LICENSE-2.0
         
     | 
| 
       9 
     | 
    
         
            -
            #
         
     | 
| 
       10 
     | 
    
         
            -
            # Unless required by applicable law or agreed to in writing, software
         
     | 
| 
       11 
     | 
    
         
            -
            # distributed under the License is distributed on an "AS IS" BASIS,
         
     | 
| 
       12 
     | 
    
         
            -
            # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         
     | 
| 
       13 
     | 
    
         
            -
            # See the License for the specific language governing permissions and
         
     | 
| 
       14 
     | 
    
         
            -
            # limitations under the License.
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
            from datetime import time
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                 
     | 
| 
       24 
     | 
    
         
            -
                 
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
       27 
     | 
    
         
            -
                 
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                 
     | 
| 
       31 
     | 
    
         
            -
                 
     | 
| 
       32 
     | 
    
         
            -
                 
     | 
| 
       33 
     | 
    
         
            -
                 
     | 
| 
       34 
     | 
    
         
            -
                 
     | 
| 
       35 
     | 
    
         
            -
                 
     | 
| 
       36 
     | 
    
         
            -
                 
     | 
| 
       37 
     | 
    
         
            -
                 
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                 
     | 
| 
       44 
     | 
    
         
            -
                 
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                 
     | 
| 
       52 
     | 
    
         
            -
                 
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                 
     | 
| 
       55 
     | 
    
         
            -
                 
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                -  
     | 
| 
       58 
     | 
    
         
            -
                -  
     | 
| 
       59 
     | 
    
         
            -
                -  
     | 
| 
       60 
     | 
    
         
            -
                 
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                 
     | 
| 
       63 
     | 
    
         
            -
                 
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                 
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                 
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                @property
         
     | 
| 
       77 
     | 
    
         
            -
                def  
     | 
| 
       78 
     | 
    
         
            -
                    return  
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                @property
         
     | 
| 
       81 
     | 
    
         
            -
                def  
     | 
| 
       82 
     | 
    
         
            -
                    return  
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                             
     | 
| 
       93 
     | 
    
         
            -
                             
     | 
| 
       94 
     | 
    
         
            -
                             
     | 
| 
       95 
     | 
    
         
            -
                             
     | 
| 
       96 
     | 
    
         
            -
                             
     | 
| 
       97 
     | 
    
         
            -
                             
     | 
| 
       98 
     | 
    
         
            -
                             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                     
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright 2016 Quantopian, Inc.
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Licensed under the Apache License, Version 2.0 (the "License");
         
     | 
| 
      
 5 
     | 
    
         
            +
            # you may not use this file except in compliance with the License.
         
     | 
| 
      
 6 
     | 
    
         
            +
            # You may obtain a copy of the License at
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
      
 8 
     | 
    
         
            +
            #     http://www.apache.org/licenses/LICENSE-2.0
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # Unless required by applicable law or agreed to in writing, software
         
     | 
| 
      
 11 
     | 
    
         
            +
            # distributed under the License is distributed on an "AS IS" BASIS,
         
     | 
| 
      
 12 
     | 
    
         
            +
            # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         
     | 
| 
      
 13 
     | 
    
         
            +
            # See the License for the specific language governing permissions and
         
     | 
| 
      
 14 
     | 
    
         
            +
            # limitations under the License.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            from datetime import time
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday
         
     | 
| 
      
 19 
     | 
    
         
            +
            import sys
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            # check python versiOn aNd import accordingly
         
     | 
| 
      
 22 
     | 
    
         
            +
            if sys.version_info >= (3, 9):
         
     | 
| 
      
 23 
     | 
    
         
            +
                # For Python 3.9 and later, import directly
         
     | 
| 
      
 24 
     | 
    
         
            +
                from zoneinfo import ZoneInfo
         
     | 
| 
      
 25 
     | 
    
         
            +
            else:
         
     | 
| 
      
 26 
     | 
    
         
            +
                # For Python 3.8 and earlier, import from backports
         
     | 
| 
      
 27 
     | 
    
         
            +
                from backports.zoneinfo import ZoneInfo
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            from pandas_market_calendars.holidays.uk import (
         
     | 
| 
      
 30 
     | 
    
         
            +
                BoxingDay,
         
     | 
| 
      
 31 
     | 
    
         
            +
                Christmas,
         
     | 
| 
      
 32 
     | 
    
         
            +
                ChristmasEve,
         
     | 
| 
      
 33 
     | 
    
         
            +
                LSENewYearsDay,
         
     | 
| 
      
 34 
     | 
    
         
            +
                LSENewYearsEve,
         
     | 
| 
      
 35 
     | 
    
         
            +
                MayBank_pre_1995,
         
     | 
| 
      
 36 
     | 
    
         
            +
                MayBank_post_1995_pre_2020,
         
     | 
| 
      
 37 
     | 
    
         
            +
                MayBank_post_2020,
         
     | 
| 
      
 38 
     | 
    
         
            +
                SpringBank_pre_2002,
         
     | 
| 
      
 39 
     | 
    
         
            +
                SpringBank_post_2002_pre_2012,
         
     | 
| 
      
 40 
     | 
    
         
            +
                SpringBank_post_2012_pre_2022,
         
     | 
| 
      
 41 
     | 
    
         
            +
                SpringBank_post_2022,
         
     | 
| 
      
 42 
     | 
    
         
            +
                SummerBank,
         
     | 
| 
      
 43 
     | 
    
         
            +
                WeekendBoxingDay,
         
     | 
| 
      
 44 
     | 
    
         
            +
                WeekendChristmas,
         
     | 
| 
      
 45 
     | 
    
         
            +
                UniqueCloses,
         
     | 
| 
      
 46 
     | 
    
         
            +
            )
         
     | 
| 
      
 47 
     | 
    
         
            +
            from pandas_market_calendars.market_calendar import MarketCalendar
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            class LSEExchangeCalendar(MarketCalendar):
         
     | 
| 
      
 51 
     | 
    
         
            +
                """
         
     | 
| 
      
 52 
     | 
    
         
            +
                Exchange calendar for the London Stock Exchange
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                Open Time: 8:00 AM, GMT
         
     | 
| 
      
 55 
     | 
    
         
            +
                Close Time: 4:30 PM, GMT
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                Regularly-Observed Holidays:
         
     | 
| 
      
 58 
     | 
    
         
            +
                - New Years Day (observed on first business day on/after)
         
     | 
| 
      
 59 
     | 
    
         
            +
                - Good Friday
         
     | 
| 
      
 60 
     | 
    
         
            +
                - Easter Monday
         
     | 
| 
      
 61 
     | 
    
         
            +
                - Early May Bank Holiday (first Monday in May)
         
     | 
| 
      
 62 
     | 
    
         
            +
                - Spring Bank Holiday (last Monday in May)
         
     | 
| 
      
 63 
     | 
    
         
            +
                - Summer Bank Holiday (last Monday in August)
         
     | 
| 
      
 64 
     | 
    
         
            +
                - Christmas Day
         
     | 
| 
      
 65 
     | 
    
         
            +
                - Dec. 27th (if Christmas is on a weekend)
         
     | 
| 
      
 66 
     | 
    
         
            +
                - Boxing Day
         
     | 
| 
      
 67 
     | 
    
         
            +
                - Dec. 28th (if Boxing Day is on a weekend)
         
     | 
| 
      
 68 
     | 
    
         
            +
                """
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                aliases = ["LSE"]
         
     | 
| 
      
 71 
     | 
    
         
            +
                regular_market_times = {
         
     | 
| 
      
 72 
     | 
    
         
            +
                    "market_open": ((None, time(8)),),
         
     | 
| 
      
 73 
     | 
    
         
            +
                    "market_close": ((None, time(16, 30)),),
         
     | 
| 
      
 74 
     | 
    
         
            +
                }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                @property
         
     | 
| 
      
 77 
     | 
    
         
            +
                def name(self):
         
     | 
| 
      
 78 
     | 
    
         
            +
                    return "LSE"
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                @property
         
     | 
| 
      
 81 
     | 
    
         
            +
                def full_name(self):
         
     | 
| 
      
 82 
     | 
    
         
            +
                    return "London Stock Exchange"
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                @property
         
     | 
| 
      
 85 
     | 
    
         
            +
                def tz(self):
         
     | 
| 
      
 86 
     | 
    
         
            +
                    return ZoneInfo("Europe/London")
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                @property
         
     | 
| 
      
 89 
     | 
    
         
            +
                def regular_holidays(self):
         
     | 
| 
      
 90 
     | 
    
         
            +
                    return AbstractHolidayCalendar(
         
     | 
| 
      
 91 
     | 
    
         
            +
                        rules=[
         
     | 
| 
      
 92 
     | 
    
         
            +
                            LSENewYearsDay,
         
     | 
| 
      
 93 
     | 
    
         
            +
                            GoodFriday,
         
     | 
| 
      
 94 
     | 
    
         
            +
                            EasterMonday,
         
     | 
| 
      
 95 
     | 
    
         
            +
                            MayBank_pre_1995,
         
     | 
| 
      
 96 
     | 
    
         
            +
                            MayBank_post_1995_pre_2020,
         
     | 
| 
      
 97 
     | 
    
         
            +
                            MayBank_post_2020,
         
     | 
| 
      
 98 
     | 
    
         
            +
                            SpringBank_pre_2002,
         
     | 
| 
      
 99 
     | 
    
         
            +
                            SpringBank_post_2002_pre_2012,
         
     | 
| 
      
 100 
     | 
    
         
            +
                            SpringBank_post_2012_pre_2022,
         
     | 
| 
      
 101 
     | 
    
         
            +
                            SpringBank_post_2022,
         
     | 
| 
      
 102 
     | 
    
         
            +
                            SummerBank,
         
     | 
| 
      
 103 
     | 
    
         
            +
                            Christmas,
         
     | 
| 
      
 104 
     | 
    
         
            +
                            WeekendChristmas,
         
     | 
| 
      
 105 
     | 
    
         
            +
                            BoxingDay,
         
     | 
| 
      
 106 
     | 
    
         
            +
                            WeekendBoxingDay,
         
     | 
| 
      
 107 
     | 
    
         
            +
                        ]
         
     | 
| 
      
 108 
     | 
    
         
            +
                    )
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                @property
         
     | 
| 
      
 111 
     | 
    
         
            +
                def adhoc_holidays(self):
         
     | 
| 
      
 112 
     | 
    
         
            +
                    return UniqueCloses
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                @property
         
     | 
| 
      
 115 
     | 
    
         
            +
                def special_closes(self):
         
     | 
| 
      
 116 
     | 
    
         
            +
                    return [
         
     | 
| 
      
 117 
     | 
    
         
            +
                        (
         
     | 
| 
      
 118 
     | 
    
         
            +
                            time(12, 30),
         
     | 
| 
      
 119 
     | 
    
         
            +
                            AbstractHolidayCalendar(
         
     | 
| 
      
 120 
     | 
    
         
            +
                                rules=[
         
     | 
| 
      
 121 
     | 
    
         
            +
                                    ChristmasEve,
         
     | 
| 
      
 122 
     | 
    
         
            +
                                    LSENewYearsEve,
         
     | 
| 
      
 123 
     | 
    
         
            +
                                ]
         
     | 
| 
      
 124 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 125 
     | 
    
         
            +
                        )
         
     | 
| 
      
 126 
     | 
    
         
            +
                    ]
         
     |