Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Douglas Franklin
Eden Juscelino
Edison Robles
Edward Betts
Eesh Saxena
Eldar Mustafayev
Emmanuel Arias
Eugenio Panadero Maciá
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,13 @@ code when available. The following financial markets are available:
<td></td>
</tr>
<tr>
<td>London Stock Exchange</td>
<td>XLON</td>
<td>London Stock Exchange (LSE) market holidays</td>
<td><strong>en_GB</strong>, en_US, th</td>
<td>HALF_DAY</td>
</tr>
<tr>
<td>NASDAQ</td>
<td>XNAS</td>
<td>National Association of Securities Dealers Automated Quotations (NASDAQ) holidays</td>
Expand Down
3 changes: 2 additions & 1 deletion holidays/countries/united_kingdom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from gettext import gettext as tr

from holidays.calendars.gregorian import APR, MAY, JUN, JUL, SEP, DEC
from holidays.constants import PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.observed_holiday_base import (
ObservedHolidayBase,
Expand Down Expand Up @@ -104,7 +105,7 @@ def _populate_common(self):
self._add_whit_monday(tr("Whit Monday"))

def _populate_subdiv_holidays(self):
if self.subdiv != "SCT":
if PUBLIC in self.categories and self.subdiv != "SCT":
if self._year >= 1975:
# New Year's Day.
self._add_observed(self._add_new_years_day(tr("New Year's Day")))
Expand Down
1 change: 1 addition & 0 deletions holidays/financial/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from holidays.financial.hong_kong_stock_exchange import HongKongStockExchange, XHKG, HKEX, SEHK
from holidays.financial.ice_futures_europe import IceFuturesEurope, ICEFuturesEurope, IFEU
from holidays.financial.japan_exchange import JapanExchange, XJPX, JPX, TSE, OSE
from holidays.financial.london_stock_exchange import LondonStockExchange, XLON, LSE
from holidays.financial.nasdaq import NASDAQ, XNAS
from holidays.financial.national_stock_exchange_of_india import (
NationalStockExchangeOfIndia,
Expand Down
62 changes: 62 additions & 0 deletions holidays/financial/london_stock_exchange.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

from gettext import gettext as tr

from holidays.constants import HALF_DAY, PUBLIC
from holidays.countries.united_kingdom import UnitedKingdom
from holidays.mixins.child_entity import ChildEntity


class LondonStockExchange(ChildEntity, UnitedKingdom):
"""London Stock Exchange (LSE) holidays.

The London Stock Exchange is closed on the bank holidays observed in
England and Wales.

On Christmas Eve and New Year's Eve the exchange runs a shortened trading
session.

References:
* <https://en.wikipedia.org/wiki/London_Stock_Exchange>
* <https://en.wikipedia.org/wiki/Bank_holiday>
* [LSE business days](https://www.londonstockexchange.com/equities-trading/business-days)
"""

country = None # type: ignore[assignment]
market = "XLON"
parent_entity = UnitedKingdom
parent_entity_subdivision_code = "ENG"
supported_categories = (HALF_DAY, PUBLIC)
start_year = 2000
Comment on lines +37 to +41

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eeshsaxena the LSE also observes early closures/half days (like Christmas Eve and New Year's Eve). Here is the reference link

​We will need to add half-day support to make this fully accurate. I've already done the research on this, so I am happy to help you implement this section if you'd like! Just let me know


def _populate_half_day_holidays(self) -> None:
# %s (markets close at 12:30pm).
close_12_30pm_label = tr("%s (markets close at 12:30pm)")

self._add_christmas_eve(
# Christmas Eve.
self._format_holiday_name(close_12_30pm_label, tr("Christmas Eve"))
)

self._add_new_years_eve(
# New Year's Eve.
self._format_holiday_name(close_12_30pm_label, tr("New Year's Eve"))
)


class XLON(LondonStockExchange):
pass


class LSE(LondonStockExchange):
pass
41 changes: 41 additions & 0 deletions holidays/locale/en_GB/LC_MESSAGES/XLON.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
#
# London Stock Exchange (LSE) holidays.
#
msgid ""
msgstr ""
"Project-Id-Version: Holidays 0.101\n"
"Report-Msgid-Bugs-To: l10n@vacanza.dev\n"
"POT-Creation-Date: 2026-07-09 00:00+0530\n"
"PO-Revision-Date: 2026-07-09 00:00+0530\n"
"Last-Translator: eeshsaxena <eeshsaxena@gmail.com>\n"
"Language-Team: Holidays Localization Team\n"
"Language: en_GB\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingva 5.0.6\n"
"X-Source-Language: en_GB\n"

#. %s (markets close at 12:30pm).
#, c-format
msgid "%s (markets close at 12:30pm)"
msgstr ""

#. Christmas Eve.
msgid "Christmas Eve"
msgstr ""

#. New Year's Eve.
msgid "New Year's Eve"
msgstr ""
41 changes: 41 additions & 0 deletions holidays/locale/en_US/LC_MESSAGES/XLON.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
#
# London Stock Exchange (LSE) holidays en_US localization.
#
msgid ""
msgstr ""
"Project-Id-Version: Holidays 0.101\n"
"Report-Msgid-Bugs-To: l10n@vacanza.dev\n"
"POT-Creation-Date: 2026-07-09 00:00+0530\n"
"PO-Revision-Date: 2026-07-09 00:00+0530\n"
"Last-Translator: eeshsaxena <eeshsaxena@gmail.com>\n"
"Language-Team: Holidays Localization Team\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingva 5.0.6\n"
"X-Source-Language: en_GB\n"

#. %s (markets close at 12:30pm).
#, c-format
msgid "%s (markets close at 12:30pm)"
msgstr "%s (markets close at 12:30pm)"

#. Christmas Eve.
msgid "Christmas Eve"
msgstr "Christmas Eve"

#. New Year's Eve.
msgid "New Year's Eve"
msgstr "New Year's Eve"
41 changes: 41 additions & 0 deletions holidays/locale/th/LC_MESSAGES/XLON.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
#
# London Stock Exchange (LSE) holidays th localization.
#
msgid ""
msgstr ""
"Project-Id-Version: Holidays 0.101\n"
"Report-Msgid-Bugs-To: l10n@vacanza.dev\n"
"POT-Creation-Date: 2026-07-09 00:00+0530\n"
"PO-Revision-Date: 2026-07-09 00:00+0530\n"
"Last-Translator: eeshsaxena <eeshsaxena@gmail.com>\n"
"Language-Team: Holidays Localization Team\n"
"Language: th\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingva 5.0.6\n"
"X-Source-Language: en_GB\n"

#. %s (markets close at 12:30pm).
#, c-format
msgid "%s (markets close at 12:30pm)"
msgstr "%s (ตลาดปิดเวลา 12:30 น.)"

#. Christmas Eve.
msgid "Christmas Eve"
msgstr "วันคริสต์มาสอีฟ"

#. New Year's Eve.
msgid "New Year's Eve"
msgstr "วันสิ้นปี"
1 change: 1 addition & 0 deletions holidays/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
"hong_kong_stock_exchange": ("HongKongStockExchange", "XHKG", "HKEX", "SEHK"),
"ice_futures_europe": ("IceFuturesEurope", "IFEU", "ICEFuturesEurope"),
"japan_exchange": ("JapanExchange", "XJPX", "JPX", "TSE", "OSE"),
"london_stock_exchange": ("LondonStockExchange", "XLON", "LSE"),
"nasdaq": ("NASDAQ", "XNAS"),
"national_stock_exchange_of_india": ("NationalStockExchangeOfIndia", "XNSE", "NSE"),
"ny_stock_exchange": ("NewYorkStockExchange", "XNYS", "NYSE"),
Expand Down
106 changes: 106 additions & 0 deletions tests/financial/test_london_stock_exchange.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# holidays
Comment thread
KJhellico marked this conversation as resolved.
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

from unittest import TestCase

from holidays.financial.london_stock_exchange import LondonStockExchange, XLON, LSE
from tests.common import CommonFinancialTests


class TestLondonStockExchange(CommonFinancialTests, TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass(LondonStockExchange)

def test_code(self):
self.assertTrue(hasattr(self.holidays, "market"))
self.assertIsNone(getattr(self.holidays, "country", None))

def test_market_aliases(self):
self.assertAliases(LondonStockExchange, XLON, LSE)

def test_no_holidays(self):
self.assertNoHolidays(LondonStockExchange(years=1999))

Comment on lines +28 to +33

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_market_aliases(self):
self.assertAliases(LondonStockExchange, XLON, LSE)
def test_no_holidays(self):
self.assertNoHolidays(LondonStockExchange(years=1999))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eeshsaxena, this remains relevant.

def test_2022(self):
# Exercises the royal one-off bank holidays alongside the regular
# England & Wales calendar; year-by-year correctness of the underlying
# calendar itself is covered by the United Kingdom test suite.
self.assertHolidaysInYear(
2022,
("2022-01-01", "New Year's Day"),
("2022-01-03", "New Year's Day (observed)"),
("2022-04-15", "Good Friday"),
("2022-04-18", "Easter Monday"),
("2022-05-02", "May Day"),
("2022-06-02", "Spring Bank Holiday"),
("2022-06-03", "Platinum Jubilee of Elizabeth II"),
("2022-08-29", "Late Summer Bank Holiday"),
("2022-09-19", "State Funeral of Queen Elizabeth II"),
("2022-12-25", "Christmas Day"),
("2022-12-26", "Boxing Day"),
("2022-12-27", "Christmas Day (observed)"),
)

def test_christmas_eve(self):
name = "Christmas Eve (markets close at 12:30pm)"
self.assertNoHolidayName(name)
self.assertHalfDayHolidayName(name, (f"{year}-12-24" for year in self.full_range))

def test_new_years_eve(self):
name = "New Year's Eve (markets close at 12:30pm)"
self.assertNoHolidayName(name)
self.assertHalfDayHolidayName(name, (f"{year}-12-31" for year in self.full_range))

def test_l10n_default(self):
self.assertLocalizedHolidays(
("2024-01-01", "New Year's Day"),
("2024-03-29", "Good Friday"),
("2024-04-01", "Easter Monday"),
("2024-05-06", "May Day"),
("2024-05-27", "Spring Bank Holiday"),
("2024-08-26", "Late Summer Bank Holiday"),
("2024-12-24", "Christmas Eve (markets close at 12:30pm)"),
("2024-12-25", "Christmas Day"),
("2024-12-26", "Boxing Day"),
("2024-12-31", "New Year's Eve (markets close at 12:30pm)"),
)

def test_l10n_en_us(self):
self.assertLocalizedHolidays(
"en_US",
("2024-01-01", "New Year's Day"),
("2024-03-29", "Good Friday"),
("2024-04-01", "Easter Monday"),
("2024-05-06", "May Day"),
("2024-05-27", "Spring Bank Holiday"),
("2024-08-26", "Late Summer Bank Holiday"),
("2024-12-24", "Christmas Eve (markets close at 12:30pm)"),
("2024-12-25", "Christmas Day"),
("2024-12-26", "Boxing Day"),
("2024-12-31", "New Year's Eve (markets close at 12:30pm)"),
)

def test_l10n_th(self):
self.assertLocalizedHolidays(
"th",
("2024-01-01", "วันขึ้นปีใหม่"),
("2024-03-29", "วันศุกร์ประเสริฐ"),
("2024-04-01", "วันจันทร์อีสเตอร์"),
("2024-05-06", "วันเมย์เดย์"),
("2024-05-27", "วันหยุดฤดูใบไม้ผลิของธนาคาร"),
("2024-08-26", "วันหยุดช่วงปลายฤดูร้อนของธนาคาร"),
("2024-12-24", "วันคริสต์มาสอีฟ (ตลาดปิดเวลา 12:30 น.)"),
("2024-12-25", "วันคริสต์มาส"),
("2024-12-26", "วันเปิดกล่องของขวัญ"),
("2024-12-31", "วันสิ้นปี (ตลาดปิดเวลา 12:30 น.)"),
)