fx-spot-dates 0.1.0__tar.gz

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.
@@ -0,0 +1,24 @@
1
+ MIT License (tests/) and CC0 1.0 (data/)
2
+
3
+ Copyright (c) 2026 Plainfold
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ The files in data/ are dedicated to the public domain under CC0 1.0
24
+ Universal: https://creativecommons.org/publicdomain/zero/1.0/legalcode
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: fx-spot-dates
3
+ Version: 0.1.0
4
+ Summary: FX settlement holidays and T+2 spot value dates for USD, EUR (TARGET2), GBP, JPY, AUD, NZD. Standard library only.
5
+ Author-email: Plainfold <plainfoldhq@proton.me>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/plainfoldhq/fx-settlement-holidays
8
+ Project-URL: Documentation, https://plainfoldhq.github.io/fx-settlement-holidays/
9
+ Project-URL: Source, https://github.com/plainfoldhq/fx-settlement-holidays
10
+ Project-URL: Issues, https://github.com/plainfoldhq/fx-settlement-holidays/issues
11
+ Keywords: fx,spot date,value date,settlement,target2,business days,holidays,forex,fedwire
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: Topic :: Office/Business :: Financial
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Dynamic: license-file
21
+
22
+ # FX settlement holidays and spot value dates 2026-2028 (CSV)
23
+
24
+ Free CSV files with the settlement holidays of six currencies for 2026, 2027 and 2028, and the T+2 spot value date for every weekday trade date of EURUSD, USDJPY, GBPUSD and EURGBP.
25
+
26
+ | Currency | Calendar |
27
+ |---|---|
28
+ | USD | Federal Reserve (Fedwire) holidays |
29
+ | EUR | TARGET2 / T2 closing days |
30
+ | GBP | England and Wales bank holidays (CHAPS, Bacs) |
31
+ | JPY | Japan bank holidays (national holidays + December 31 to January 3) |
32
+ | AUD | New South Wales bank holidays, Sydney only (2028 only here: see below) |
33
+ | NZD | New Zealand holidays incl. Wellington Anniversary (Wellington only; Auckland Anniversary not included) |
34
+
35
+ ## Python package
36
+
37
+ `fx-spot-dates` (standard library only) bundles the 2026-2028 calendars:
38
+
39
+ ```python
40
+ import fx_spot_dates as fx
41
+ fx.spot_date("USDJPY", "2026-12-29") # datetime.date(2027, 1, 4)
42
+ fx.is_business_day("USD", "2026-07-03") # True: the Fed does not close the Friday before a Saturday holiday
43
+ fx.add_business_days(["EUR", "GBP"], "2026-12-23", 2)
44
+ ```
45
+
46
+ Install: `pip install "git+https://github.com/plainfoldhq/fx-settlement-holidays"` (a PyPI release is pending).
47
+
48
+ ## Files
49
+
50
+ `data/settlement_holidays_2026_2028.csv`: one row per weekday holiday: `date`, `weekday`, `currency`, `calendar`, `holiday` (English name).
51
+
52
+ `data/fx_spot_dates_2026_2028.csv`: `trade_date` (every weekday), `pair`, `spot_date`, `calendar_days`.
53
+
54
+ `data/coverage_2026_2028.csv`: which currency-years are included. AUD 2026 and 2027 are not: the two implementations disagree on the Monday after Anzac Day (2026-04-27, 2027-04-26).
55
+
56
+ ```python
57
+ import csv
58
+ spot = {(r["pair"], r["trade_date"]): r["spot_date"]
59
+ for r in csv.DictReader(open("data/fx_spot_dates_2026_2028.csv"))}
60
+ spot[("USDJPY", "2026-12-29")] # '2027-01-04': Japanese banks close Dec 31 - Jan 3
61
+ ```
62
+
63
+ Load straight from GitHub:
64
+
65
+ ```python
66
+ import pandas as pd
67
+ url = "https://raw.githubusercontent.com/plainfoldhq/fx-settlement-holidays/main/data/settlement_holidays_2026_2028.csv"
68
+ pd.read_csv(url).query("currency == 'EUR'") # TARGET2 closing days
69
+ ```
70
+
71
+ ## Spot convention
72
+
73
+ T+2. For pairs with USD, day 1 is the next business day of the non-USD currency (a USD holiday on day 1 does not count) and day 2 the next day that is a business day in both currencies. For crosses (EURGBP), two business days of both currencies, then forward to the first day that is also a USD business day. Some banks apply other rules: confirm with your counterparty.
74
+
75
+ ## How the data is made and checked
76
+
77
+ - Holidays: generated with the Python [`holidays`](https://github.com/vacanza/holidays) package (MIT) and kept only for currency-years where [QuantLib](https://www.quantlib.org/) (an independent implementation) agrees on every weekday.
78
+ - `tests/` recomputes every holiday and every spot date with QuantLib on each push (CI).
79
+
80
+ ## Limits
81
+
82
+ Future dates follow current rules; central banks and governments can add holidays (for example a state funeral). Not compared with official central-bank or CLS calendars. Not financial advice; not for use as the only source for settlement decisions. Not affiliated with any central bank, payment system or CLS.
83
+
84
+ ## Full pack: 2000-2050, 15 pairs
85
+
86
+ The paid pack covers 2000-2050 (296 of 306 currency-years), a day-by-day business-day table per currency, spot value dates for all 15 pairs of these currencies, SQLite, JSON, .ics, a tested PostgreSQL loader and a standard-library helper (`spot_date`, `add_business_days`). $19: [buy on Polar](https://buy.polar.sh/polar_cl_9Rkaup8QpzW7cYaFe9nRx0AEiUSxVLMzYyU1K23uuVP) (checkout and tax by Polar, merchant of record). Also in the [All-Access yearly plan](https://buy.polar.sh/polar_cl_xydfuofU72fdp6xSOHFtihAuniUFagYOwR9zf2M03Gl) with every Plainfold data pack.
87
+
88
+ More calendars: [options expiration dates](https://github.com/plainfoldhq/options-expiration-dates), [stock exchange holidays](https://github.com/plainfoldhq/stock-exchange-holidays), [public holidays by country](https://github.com/plainfoldhq/world-public-holidays), [US federal/NYSE/Fed business days](https://github.com/plainfoldhq/us-federal-calendar). Reference pages: [plainfoldhq.github.io](https://plainfoldhq.github.io/).
89
+
90
+ ## License
91
+
92
+ Data in `data/`: CC0 1.0 (public domain). Tests: MIT. See LICENSE.
93
+
94
+ Made by Plainfold, an AI-run business. Issues and corrections: open an issue or email plainfoldhq@proton.me.
@@ -0,0 +1,73 @@
1
+ # FX settlement holidays and spot value dates 2026-2028 (CSV)
2
+
3
+ Free CSV files with the settlement holidays of six currencies for 2026, 2027 and 2028, and the T+2 spot value date for every weekday trade date of EURUSD, USDJPY, GBPUSD and EURGBP.
4
+
5
+ | Currency | Calendar |
6
+ |---|---|
7
+ | USD | Federal Reserve (Fedwire) holidays |
8
+ | EUR | TARGET2 / T2 closing days |
9
+ | GBP | England and Wales bank holidays (CHAPS, Bacs) |
10
+ | JPY | Japan bank holidays (national holidays + December 31 to January 3) |
11
+ | AUD | New South Wales bank holidays, Sydney only (2028 only here: see below) |
12
+ | NZD | New Zealand holidays incl. Wellington Anniversary (Wellington only; Auckland Anniversary not included) |
13
+
14
+ ## Python package
15
+
16
+ `fx-spot-dates` (standard library only) bundles the 2026-2028 calendars:
17
+
18
+ ```python
19
+ import fx_spot_dates as fx
20
+ fx.spot_date("USDJPY", "2026-12-29") # datetime.date(2027, 1, 4)
21
+ fx.is_business_day("USD", "2026-07-03") # True: the Fed does not close the Friday before a Saturday holiday
22
+ fx.add_business_days(["EUR", "GBP"], "2026-12-23", 2)
23
+ ```
24
+
25
+ Install: `pip install "git+https://github.com/plainfoldhq/fx-settlement-holidays"` (a PyPI release is pending).
26
+
27
+ ## Files
28
+
29
+ `data/settlement_holidays_2026_2028.csv`: one row per weekday holiday: `date`, `weekday`, `currency`, `calendar`, `holiday` (English name).
30
+
31
+ `data/fx_spot_dates_2026_2028.csv`: `trade_date` (every weekday), `pair`, `spot_date`, `calendar_days`.
32
+
33
+ `data/coverage_2026_2028.csv`: which currency-years are included. AUD 2026 and 2027 are not: the two implementations disagree on the Monday after Anzac Day (2026-04-27, 2027-04-26).
34
+
35
+ ```python
36
+ import csv
37
+ spot = {(r["pair"], r["trade_date"]): r["spot_date"]
38
+ for r in csv.DictReader(open("data/fx_spot_dates_2026_2028.csv"))}
39
+ spot[("USDJPY", "2026-12-29")] # '2027-01-04': Japanese banks close Dec 31 - Jan 3
40
+ ```
41
+
42
+ Load straight from GitHub:
43
+
44
+ ```python
45
+ import pandas as pd
46
+ url = "https://raw.githubusercontent.com/plainfoldhq/fx-settlement-holidays/main/data/settlement_holidays_2026_2028.csv"
47
+ pd.read_csv(url).query("currency == 'EUR'") # TARGET2 closing days
48
+ ```
49
+
50
+ ## Spot convention
51
+
52
+ T+2. For pairs with USD, day 1 is the next business day of the non-USD currency (a USD holiday on day 1 does not count) and day 2 the next day that is a business day in both currencies. For crosses (EURGBP), two business days of both currencies, then forward to the first day that is also a USD business day. Some banks apply other rules: confirm with your counterparty.
53
+
54
+ ## How the data is made and checked
55
+
56
+ - Holidays: generated with the Python [`holidays`](https://github.com/vacanza/holidays) package (MIT) and kept only for currency-years where [QuantLib](https://www.quantlib.org/) (an independent implementation) agrees on every weekday.
57
+ - `tests/` recomputes every holiday and every spot date with QuantLib on each push (CI).
58
+
59
+ ## Limits
60
+
61
+ Future dates follow current rules; central banks and governments can add holidays (for example a state funeral). Not compared with official central-bank or CLS calendars. Not financial advice; not for use as the only source for settlement decisions. Not affiliated with any central bank, payment system or CLS.
62
+
63
+ ## Full pack: 2000-2050, 15 pairs
64
+
65
+ The paid pack covers 2000-2050 (296 of 306 currency-years), a day-by-day business-day table per currency, spot value dates for all 15 pairs of these currencies, SQLite, JSON, .ics, a tested PostgreSQL loader and a standard-library helper (`spot_date`, `add_business_days`). $19: [buy on Polar](https://buy.polar.sh/polar_cl_9Rkaup8QpzW7cYaFe9nRx0AEiUSxVLMzYyU1K23uuVP) (checkout and tax by Polar, merchant of record). Also in the [All-Access yearly plan](https://buy.polar.sh/polar_cl_xydfuofU72fdp6xSOHFtihAuniUFagYOwR9zf2M03Gl) with every Plainfold data pack.
66
+
67
+ More calendars: [options expiration dates](https://github.com/plainfoldhq/options-expiration-dates), [stock exchange holidays](https://github.com/plainfoldhq/stock-exchange-holidays), [public holidays by country](https://github.com/plainfoldhq/world-public-holidays), [US federal/NYSE/Fed business days](https://github.com/plainfoldhq/us-federal-calendar). Reference pages: [plainfoldhq.github.io](https://plainfoldhq.github.io/).
68
+
69
+ ## License
70
+
71
+ Data in `data/`: CC0 1.0 (public domain). Tests: MIT. See LICENSE.
72
+
73
+ Made by Plainfold, an AI-run business. Issues and corrections: open an issue or email plainfoldhq@proton.me.
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fx-spot-dates"
7
+ version = "0.1.0"
8
+ description = "FX settlement holidays and T+2 spot value dates for USD, EUR (TARGET2), GBP, JPY, AUD, NZD. Standard library only."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [{ name = "Plainfold", email = "plainfoldhq@proton.me" }]
13
+ keywords = ["fx", "spot date", "value date", "settlement", "target2", "business days", "holidays", "forex", "fedwire"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Financial and Insurance Industry",
19
+ "Topic :: Office/Business :: Financial",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/plainfoldhq/fx-settlement-holidays"
24
+ Documentation = "https://plainfoldhq.github.io/fx-settlement-holidays/"
25
+ Source = "https://github.com/plainfoldhq/fx-settlement-holidays"
26
+ Issues = "https://github.com/plainfoldhq/fx-settlement-holidays/issues"
27
+
28
+ [project.scripts]
29
+ fx-spot-dates = "fx_spot_dates:cli"
30
+
31
+ [tool.setuptools.package-data]
32
+ fx_spot_dates = ["data/*.csv"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,121 @@
1
+ """FX settlement business days and T+2 spot value dates for USD, EUR, GBP, JPY, AUD, NZD (2026-2028).
2
+
3
+ >>> import fx_spot_dates as fx
4
+ >>> fx.spot_date("USDJPY", "2026-12-29")
5
+ datetime.date(2027, 1, 4)
6
+ >>> fx.is_business_day("EUR", "2026-12-24") # TARGET2 is open on Christmas Eve
7
+ True
8
+
9
+ Calendars: USD Federal Reserve (Fedwire), EUR TARGET2, GBP England and Wales bank holidays, JPY Japan bank
10
+ holidays, AUD New South Wales bank holidays (2028 only), NZD New Zealand incl. Wellington Anniversary.
11
+ Dates come from the Python `holidays` package and were kept only where QuantLib agrees on every weekday.
12
+ Outside the covered currency-years every function raises NotCovered (it never guesses).
13
+
14
+ Spot convention (T+2): for pairs with USD, day 1 is the next business day of the non-USD currency and day 2 the
15
+ next day that is a business day in both; for crosses, two business days of both currencies, then forward to
16
+ the first day that is also a USD business day. Some banks use other rules: confirm with your counterparty.
17
+ Not financial advice. Full 2000-2050 data and 15-pair tables: https://github.com/plainfoldhq/fx-settlement-holidays
18
+ """
19
+ import csv
20
+ import os
21
+ from datetime import date, timedelta
22
+
23
+ __version__ = "0.1.0"
24
+ __all__ = ["CURRENCIES", "NotCovered", "is_business_day", "add_business_days", "spot_date", "holidays"]
25
+
26
+ _DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
27
+ CURRENCIES = ("USD", "EUR", "GBP", "JPY", "AUD", "NZD")
28
+
29
+
30
+ class NotCovered(ValueError):
31
+ """The currency-year is not in the bundled data."""
32
+
33
+
34
+ def _load():
35
+ covered, closed = set(), {}
36
+ with open(os.path.join(_DATA, "coverage_2026_2028.csv"), newline="", encoding="utf-8") as f:
37
+ for r in csv.DictReader(f):
38
+ if r["status"] == "covered":
39
+ covered.add((r["currency"], int(r["year"])))
40
+ with open(os.path.join(_DATA, "settlement_holidays_2026_2028.csv"), newline="", encoding="utf-8") as f:
41
+ for r in csv.DictReader(f):
42
+ closed[(r["currency"], date.fromisoformat(r["date"]))] = r["holiday"]
43
+ return covered, closed
44
+
45
+
46
+ _COVERED, _CLOSED = _load()
47
+
48
+
49
+ def _d(x):
50
+ return x if isinstance(x, date) else date.fromisoformat(str(x))
51
+
52
+
53
+ def is_business_day(currency, d):
54
+ """True if `d` is a settlement business day for `currency`."""
55
+ c, d = currency.upper(), _d(d)
56
+ if c not in CURRENCIES:
57
+ raise KeyError(f"unknown currency {currency}; available: {', '.join(CURRENCIES)}")
58
+ if (c, d.year) not in _COVERED:
59
+ raise NotCovered(f"{c} {d.year} is not covered (bundled: 2026-2028; AUD 2028 only)")
60
+ return d.weekday() < 5 and (c, d) not in _CLOSED
61
+
62
+
63
+ def holidays(currency, year):
64
+ """[(date, name)] weekday settlement holidays of `currency` in `year`."""
65
+ c = currency.upper()
66
+ is_business_day(c, date(year, 1, 1)) # raises for unknown/uncovered
67
+ return sorted((d, n) for (cc, d), n in _CLOSED.items() if cc == c and d.year == year)
68
+
69
+
70
+ def _joint(ccys, d):
71
+ return all([is_business_day(c, d) for c in ccys])
72
+
73
+
74
+ def add_business_days(currencies, d, n):
75
+ """n >= 0 days that are business days in every currency of `currencies` (n = 0: d or the next such day)."""
76
+ if isinstance(currencies, str):
77
+ currencies = [currencies]
78
+ d = _d(d)
79
+ if n < 0:
80
+ raise ValueError("n must be >= 0")
81
+ if n == 0:
82
+ while not _joint(currencies, d):
83
+ d += timedelta(days=1)
84
+ return d
85
+ for _ in range(n):
86
+ d += timedelta(days=1)
87
+ while not _joint(currencies, d):
88
+ d += timedelta(days=1)
89
+ return d
90
+
91
+
92
+ def spot_date(pair, trade_date):
93
+ """T+2 spot value date for a 6-letter pair such as 'EURUSD' and a weekday trade date."""
94
+ pair = pair.upper().replace("/", "")
95
+ a, b = pair[:3], pair[3:]
96
+ t = _d(trade_date)
97
+ if len(pair) != 6 or a == b:
98
+ raise ValueError(f"not a currency pair: {pair}")
99
+ if t.weekday() >= 5:
100
+ raise ValueError(f"trade date {t} is a weekend")
101
+ if "USD" in (a, b):
102
+ other = b if a == "USD" else a
103
+ return add_business_days([a, b], add_business_days([other], t, 1), 1)
104
+ return add_business_days([a, b, "USD"], add_business_days([a, b], t, 2), 0)
105
+
106
+
107
+ def cli(argv=None):
108
+ import sys
109
+ argv = sys.argv[1:] if argv is None else argv
110
+ if len(argv) != 2:
111
+ print("usage: fx-spot-dates EURUSD 2026-12-24 | fx-spot-dates USD 2026-07-03")
112
+ return 2
113
+ try:
114
+ if len(argv[0].replace("/", "")) == 6:
115
+ print(spot_date(argv[0], argv[1]))
116
+ else:
117
+ print("business day" if is_business_day(argv[0], argv[1]) else "holiday/weekend")
118
+ except (NotCovered, KeyError, ValueError) as e:
119
+ print(f"error: {e}", file=sys.stderr)
120
+ return 1
121
+ return 0
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from . import cli
4
+
5
+ sys.exit(cli())
@@ -0,0 +1,19 @@
1
+ currency,year,status,reason
2
+ USD,2026,covered,
3
+ USD,2027,covered,
4
+ USD,2028,covered,
5
+ EUR,2026,covered,
6
+ EUR,2027,covered,
7
+ EUR,2028,covered,
8
+ GBP,2026,covered,
9
+ GBP,2027,covered,
10
+ GBP,2028,covered,
11
+ JPY,2026,covered,
12
+ JPY,2027,covered,
13
+ JPY,2028,covered,
14
+ AUD,2026,not_covered,sources disagree on 1 weekday(s): 2026-04-27
15
+ AUD,2027,not_covered,sources disagree on 1 weekday(s): 2027-04-26
16
+ AUD,2028,covered,
17
+ NZD,2026,covered,
18
+ NZD,2027,covered,
19
+ NZD,2028,covered,
@@ -0,0 +1,163 @@
1
+ date,weekday,currency,calendar,holiday
2
+ 2026-01-01,Thu,USD,Federal Reserve (Fedwire) holidays,New Year's Day
3
+ 2026-01-01,Thu,EUR,TARGET2 / T2 closing days,New Year's Day
4
+ 2026-01-01,Thu,GBP,"England and Wales bank holidays (CHAPS, Bacs)",New Year's Day
5
+ 2026-01-01,Thu,JPY,Japan bank holidays,Bank Holiday; New Year's Day
6
+ 2026-01-01,Thu,NZD,New Zealand holidays incl. Wellington Anniversary,New Year's Day
7
+ 2026-01-02,Fri,JPY,Japan bank holidays,Bank Holiday
8
+ 2026-01-02,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Day after New Year's Day
9
+ 2026-01-12,Mon,JPY,Japan bank holidays,Coming of Age Day
10
+ 2026-01-19,Mon,USD,Federal Reserve (Fedwire) holidays,"Birthday of Martin Luther King, Jr."
11
+ 2026-01-19,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Wellington Anniversary Day
12
+ 2026-02-06,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Waitangi Day
13
+ 2026-02-11,Wed,JPY,Japan bank holidays,Foundation Day
14
+ 2026-02-16,Mon,USD,Federal Reserve (Fedwire) holidays,Washington's Birthday
15
+ 2026-02-23,Mon,JPY,Japan bank holidays,Emperor's Birthday
16
+ 2026-03-20,Fri,JPY,Japan bank holidays,Vernal Equinox Day
17
+ 2026-04-03,Fri,EUR,TARGET2 / T2 closing days,Good Friday
18
+ 2026-04-03,Fri,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Good Friday
19
+ 2026-04-03,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Good Friday
20
+ 2026-04-06,Mon,EUR,TARGET2 / T2 closing days,Easter Monday
21
+ 2026-04-06,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Easter Monday
22
+ 2026-04-06,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Easter Monday
23
+ 2026-04-27,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Anzac Day (observed)
24
+ 2026-04-29,Wed,JPY,Japan bank holidays,Showa Day
25
+ 2026-05-01,Fri,EUR,TARGET2 / T2 closing days,Labour Day
26
+ 2026-05-04,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",May Day
27
+ 2026-05-04,Mon,JPY,Japan bank holidays,Greenery Day
28
+ 2026-05-05,Tue,JPY,Japan bank holidays,Children's Day
29
+ 2026-05-06,Wed,JPY,Japan bank holidays,Substitute Holiday
30
+ 2026-05-25,Mon,USD,Federal Reserve (Fedwire) holidays,Memorial Day
31
+ 2026-05-25,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Spring Bank Holiday
32
+ 2026-06-01,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,King's Birthday
33
+ 2026-06-19,Fri,USD,Federal Reserve (Fedwire) holidays,Juneteenth National Independence Day
34
+ 2026-07-10,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Matariki
35
+ 2026-07-20,Mon,JPY,Japan bank holidays,Marine Day
36
+ 2026-08-11,Tue,JPY,Japan bank holidays,Mountain Day
37
+ 2026-08-31,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Late Summer Bank Holiday
38
+ 2026-09-07,Mon,USD,Federal Reserve (Fedwire) holidays,Labor Day
39
+ 2026-09-21,Mon,JPY,Japan bank holidays,Respect for the Aged Day
40
+ 2026-09-22,Tue,JPY,Japan bank holidays,National Holiday
41
+ 2026-09-23,Wed,JPY,Japan bank holidays,Autumnal Equinox Day
42
+ 2026-10-12,Mon,USD,Federal Reserve (Fedwire) holidays,Columbus Day
43
+ 2026-10-12,Mon,JPY,Japan bank holidays,Sports Day
44
+ 2026-10-26,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Labour Day
45
+ 2026-11-03,Tue,JPY,Japan bank holidays,Culture Day
46
+ 2026-11-11,Wed,USD,Federal Reserve (Fedwire) holidays,Veterans Day
47
+ 2026-11-23,Mon,JPY,Japan bank holidays,Labor Thanksgiving Day
48
+ 2026-11-26,Thu,USD,Federal Reserve (Fedwire) holidays,Thanksgiving Day
49
+ 2026-12-25,Fri,USD,Federal Reserve (Fedwire) holidays,Christmas Day
50
+ 2026-12-25,Fri,EUR,TARGET2 / T2 closing days,Christmas Day
51
+ 2026-12-25,Fri,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Christmas Day
52
+ 2026-12-25,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Christmas Day
53
+ 2026-12-28,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Boxing Day (observed)
54
+ 2026-12-28,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Boxing Day (observed)
55
+ 2026-12-31,Thu,JPY,Japan bank holidays,Bank Holiday
56
+ 2027-01-01,Fri,USD,Federal Reserve (Fedwire) holidays,New Year's Day
57
+ 2027-01-01,Fri,EUR,TARGET2 / T2 closing days,New Year's Day
58
+ 2027-01-01,Fri,GBP,"England and Wales bank holidays (CHAPS, Bacs)",New Year's Day
59
+ 2027-01-01,Fri,JPY,Japan bank holidays,Bank Holiday; New Year's Day
60
+ 2027-01-01,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,New Year's Day
61
+ 2027-01-04,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Day after New Year's Day (observed)
62
+ 2027-01-11,Mon,JPY,Japan bank holidays,Coming of Age Day
63
+ 2027-01-18,Mon,USD,Federal Reserve (Fedwire) holidays,"Birthday of Martin Luther King, Jr."
64
+ 2027-01-25,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Wellington Anniversary Day
65
+ 2027-02-08,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Waitangi Day (observed)
66
+ 2027-02-11,Thu,JPY,Japan bank holidays,Foundation Day
67
+ 2027-02-15,Mon,USD,Federal Reserve (Fedwire) holidays,Washington's Birthday
68
+ 2027-02-23,Tue,JPY,Japan bank holidays,Emperor's Birthday
69
+ 2027-03-22,Mon,JPY,Japan bank holidays,Substitute Holiday
70
+ 2027-03-26,Fri,EUR,TARGET2 / T2 closing days,Good Friday
71
+ 2027-03-26,Fri,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Good Friday
72
+ 2027-03-26,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Good Friday
73
+ 2027-03-29,Mon,EUR,TARGET2 / T2 closing days,Easter Monday
74
+ 2027-03-29,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Easter Monday
75
+ 2027-03-29,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Easter Monday
76
+ 2027-04-26,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Anzac Day (observed)
77
+ 2027-04-29,Thu,JPY,Japan bank holidays,Showa Day
78
+ 2027-05-03,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",May Day
79
+ 2027-05-03,Mon,JPY,Japan bank holidays,Constitution Day
80
+ 2027-05-04,Tue,JPY,Japan bank holidays,Greenery Day
81
+ 2027-05-05,Wed,JPY,Japan bank holidays,Children's Day
82
+ 2027-05-31,Mon,USD,Federal Reserve (Fedwire) holidays,Memorial Day
83
+ 2027-05-31,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Spring Bank Holiday
84
+ 2027-06-07,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,King's Birthday
85
+ 2027-06-25,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Matariki
86
+ 2027-07-05,Mon,USD,Federal Reserve (Fedwire) holidays,Independence Day (observed)
87
+ 2027-07-19,Mon,JPY,Japan bank holidays,Marine Day
88
+ 2027-08-11,Wed,JPY,Japan bank holidays,Mountain Day
89
+ 2027-08-30,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Late Summer Bank Holiday
90
+ 2027-09-06,Mon,USD,Federal Reserve (Fedwire) holidays,Labor Day
91
+ 2027-09-20,Mon,JPY,Japan bank holidays,Respect for the Aged Day
92
+ 2027-09-23,Thu,JPY,Japan bank holidays,Autumnal Equinox Day
93
+ 2027-10-11,Mon,USD,Federal Reserve (Fedwire) holidays,Columbus Day
94
+ 2027-10-11,Mon,JPY,Japan bank holidays,Sports Day
95
+ 2027-10-25,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Labour Day
96
+ 2027-11-03,Wed,JPY,Japan bank holidays,Culture Day
97
+ 2027-11-11,Thu,USD,Federal Reserve (Fedwire) holidays,Veterans Day
98
+ 2027-11-23,Tue,JPY,Japan bank holidays,Labor Thanksgiving Day
99
+ 2027-11-25,Thu,USD,Federal Reserve (Fedwire) holidays,Thanksgiving Day
100
+ 2027-12-27,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Christmas Day (observed)
101
+ 2027-12-27,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Christmas Day (observed)
102
+ 2027-12-28,Tue,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Boxing Day (observed)
103
+ 2027-12-28,Tue,NZD,New Zealand holidays incl. Wellington Anniversary,Boxing Day (observed)
104
+ 2027-12-31,Fri,JPY,Japan bank holidays,Bank Holiday
105
+ 2028-01-03,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",New Year's Day (observed)
106
+ 2028-01-03,Mon,JPY,Japan bank holidays,Bank Holiday
107
+ 2028-01-03,Mon,AUD,New South Wales bank holidays (Sydney),New Year's Day (observed)
108
+ 2028-01-03,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,New Year's Day (observed)
109
+ 2028-01-04,Tue,NZD,New Zealand holidays incl. Wellington Anniversary,Day after New Year's Day (observed)
110
+ 2028-01-10,Mon,JPY,Japan bank holidays,Coming of Age Day
111
+ 2028-01-17,Mon,USD,Federal Reserve (Fedwire) holidays,"Birthday of Martin Luther King, Jr."
112
+ 2028-01-24,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Wellington Anniversary Day
113
+ 2028-01-26,Wed,AUD,New South Wales bank holidays (Sydney),Australia Day
114
+ 2028-02-07,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Waitangi Day (observed)
115
+ 2028-02-11,Fri,JPY,Japan bank holidays,Foundation Day
116
+ 2028-02-21,Mon,USD,Federal Reserve (Fedwire) holidays,Washington's Birthday
117
+ 2028-02-23,Wed,JPY,Japan bank holidays,Emperor's Birthday
118
+ 2028-03-20,Mon,JPY,Japan bank holidays,Vernal Equinox Day
119
+ 2028-04-14,Fri,EUR,TARGET2 / T2 closing days,Good Friday
120
+ 2028-04-14,Fri,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Good Friday
121
+ 2028-04-14,Fri,AUD,New South Wales bank holidays (Sydney),Good Friday
122
+ 2028-04-14,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Good Friday
123
+ 2028-04-17,Mon,EUR,TARGET2 / T2 closing days,Easter Monday
124
+ 2028-04-17,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Easter Monday
125
+ 2028-04-17,Mon,AUD,New South Wales bank holidays (Sydney),Easter Monday
126
+ 2028-04-17,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Easter Monday
127
+ 2028-04-25,Tue,AUD,New South Wales bank holidays (Sydney),ANZAC Day
128
+ 2028-04-25,Tue,NZD,New Zealand holidays incl. Wellington Anniversary,Anzac Day
129
+ 2028-05-01,Mon,EUR,TARGET2 / T2 closing days,Labour Day
130
+ 2028-05-01,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",May Day
131
+ 2028-05-03,Wed,JPY,Japan bank holidays,Constitution Day
132
+ 2028-05-04,Thu,JPY,Japan bank holidays,Greenery Day
133
+ 2028-05-05,Fri,JPY,Japan bank holidays,Children's Day
134
+ 2028-05-29,Mon,USD,Federal Reserve (Fedwire) holidays,Memorial Day
135
+ 2028-05-29,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Spring Bank Holiday
136
+ 2028-06-05,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,King's Birthday
137
+ 2028-06-12,Mon,AUD,New South Wales bank holidays (Sydney),King's Birthday
138
+ 2028-06-19,Mon,USD,Federal Reserve (Fedwire) holidays,Juneteenth National Independence Day
139
+ 2028-07-04,Tue,USD,Federal Reserve (Fedwire) holidays,Independence Day
140
+ 2028-07-14,Fri,NZD,New Zealand holidays incl. Wellington Anniversary,Matariki
141
+ 2028-07-17,Mon,JPY,Japan bank holidays,Marine Day
142
+ 2028-08-07,Mon,AUD,New South Wales bank holidays (Sydney),Bank Holiday
143
+ 2028-08-11,Fri,JPY,Japan bank holidays,Mountain Day
144
+ 2028-08-28,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Late Summer Bank Holiday
145
+ 2028-09-04,Mon,USD,Federal Reserve (Fedwire) holidays,Labor Day
146
+ 2028-09-18,Mon,JPY,Japan bank holidays,Respect for the Aged Day
147
+ 2028-09-22,Fri,JPY,Japan bank holidays,Autumnal Equinox Day
148
+ 2028-10-02,Mon,AUD,New South Wales bank holidays (Sydney),Labor Day
149
+ 2028-10-09,Mon,USD,Federal Reserve (Fedwire) holidays,Columbus Day
150
+ 2028-10-09,Mon,JPY,Japan bank holidays,Sports Day
151
+ 2028-10-23,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Labour Day
152
+ 2028-11-03,Fri,JPY,Japan bank holidays,Culture Day
153
+ 2028-11-23,Thu,USD,Federal Reserve (Fedwire) holidays,Thanksgiving Day
154
+ 2028-11-23,Thu,JPY,Japan bank holidays,Labor Thanksgiving Day
155
+ 2028-12-25,Mon,USD,Federal Reserve (Fedwire) holidays,Christmas Day
156
+ 2028-12-25,Mon,EUR,TARGET2 / T2 closing days,Christmas Day
157
+ 2028-12-25,Mon,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Christmas Day
158
+ 2028-12-25,Mon,AUD,New South Wales bank holidays (Sydney),Christmas Day
159
+ 2028-12-25,Mon,NZD,New Zealand holidays incl. Wellington Anniversary,Christmas Day
160
+ 2028-12-26,Tue,EUR,TARGET2 / T2 closing days,Christmas Holiday
161
+ 2028-12-26,Tue,GBP,"England and Wales bank holidays (CHAPS, Bacs)",Boxing Day
162
+ 2028-12-26,Tue,AUD,New South Wales bank holidays (Sydney),Boxing Day
163
+ 2028-12-26,Tue,NZD,New Zealand holidays incl. Wellington Anniversary,Boxing Day
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: fx-spot-dates
3
+ Version: 0.1.0
4
+ Summary: FX settlement holidays and T+2 spot value dates for USD, EUR (TARGET2), GBP, JPY, AUD, NZD. Standard library only.
5
+ Author-email: Plainfold <plainfoldhq@proton.me>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/plainfoldhq/fx-settlement-holidays
8
+ Project-URL: Documentation, https://plainfoldhq.github.io/fx-settlement-holidays/
9
+ Project-URL: Source, https://github.com/plainfoldhq/fx-settlement-holidays
10
+ Project-URL: Issues, https://github.com/plainfoldhq/fx-settlement-holidays/issues
11
+ Keywords: fx,spot date,value date,settlement,target2,business days,holidays,forex,fedwire
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: Topic :: Office/Business :: Financial
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Dynamic: license-file
21
+
22
+ # FX settlement holidays and spot value dates 2026-2028 (CSV)
23
+
24
+ Free CSV files with the settlement holidays of six currencies for 2026, 2027 and 2028, and the T+2 spot value date for every weekday trade date of EURUSD, USDJPY, GBPUSD and EURGBP.
25
+
26
+ | Currency | Calendar |
27
+ |---|---|
28
+ | USD | Federal Reserve (Fedwire) holidays |
29
+ | EUR | TARGET2 / T2 closing days |
30
+ | GBP | England and Wales bank holidays (CHAPS, Bacs) |
31
+ | JPY | Japan bank holidays (national holidays + December 31 to January 3) |
32
+ | AUD | New South Wales bank holidays, Sydney only (2028 only here: see below) |
33
+ | NZD | New Zealand holidays incl. Wellington Anniversary (Wellington only; Auckland Anniversary not included) |
34
+
35
+ ## Python package
36
+
37
+ `fx-spot-dates` (standard library only) bundles the 2026-2028 calendars:
38
+
39
+ ```python
40
+ import fx_spot_dates as fx
41
+ fx.spot_date("USDJPY", "2026-12-29") # datetime.date(2027, 1, 4)
42
+ fx.is_business_day("USD", "2026-07-03") # True: the Fed does not close the Friday before a Saturday holiday
43
+ fx.add_business_days(["EUR", "GBP"], "2026-12-23", 2)
44
+ ```
45
+
46
+ Install: `pip install "git+https://github.com/plainfoldhq/fx-settlement-holidays"` (a PyPI release is pending).
47
+
48
+ ## Files
49
+
50
+ `data/settlement_holidays_2026_2028.csv`: one row per weekday holiday: `date`, `weekday`, `currency`, `calendar`, `holiday` (English name).
51
+
52
+ `data/fx_spot_dates_2026_2028.csv`: `trade_date` (every weekday), `pair`, `spot_date`, `calendar_days`.
53
+
54
+ `data/coverage_2026_2028.csv`: which currency-years are included. AUD 2026 and 2027 are not: the two implementations disagree on the Monday after Anzac Day (2026-04-27, 2027-04-26).
55
+
56
+ ```python
57
+ import csv
58
+ spot = {(r["pair"], r["trade_date"]): r["spot_date"]
59
+ for r in csv.DictReader(open("data/fx_spot_dates_2026_2028.csv"))}
60
+ spot[("USDJPY", "2026-12-29")] # '2027-01-04': Japanese banks close Dec 31 - Jan 3
61
+ ```
62
+
63
+ Load straight from GitHub:
64
+
65
+ ```python
66
+ import pandas as pd
67
+ url = "https://raw.githubusercontent.com/plainfoldhq/fx-settlement-holidays/main/data/settlement_holidays_2026_2028.csv"
68
+ pd.read_csv(url).query("currency == 'EUR'") # TARGET2 closing days
69
+ ```
70
+
71
+ ## Spot convention
72
+
73
+ T+2. For pairs with USD, day 1 is the next business day of the non-USD currency (a USD holiday on day 1 does not count) and day 2 the next day that is a business day in both currencies. For crosses (EURGBP), two business days of both currencies, then forward to the first day that is also a USD business day. Some banks apply other rules: confirm with your counterparty.
74
+
75
+ ## How the data is made and checked
76
+
77
+ - Holidays: generated with the Python [`holidays`](https://github.com/vacanza/holidays) package (MIT) and kept only for currency-years where [QuantLib](https://www.quantlib.org/) (an independent implementation) agrees on every weekday.
78
+ - `tests/` recomputes every holiday and every spot date with QuantLib on each push (CI).
79
+
80
+ ## Limits
81
+
82
+ Future dates follow current rules; central banks and governments can add holidays (for example a state funeral). Not compared with official central-bank or CLS calendars. Not financial advice; not for use as the only source for settlement decisions. Not affiliated with any central bank, payment system or CLS.
83
+
84
+ ## Full pack: 2000-2050, 15 pairs
85
+
86
+ The paid pack covers 2000-2050 (296 of 306 currency-years), a day-by-day business-day table per currency, spot value dates for all 15 pairs of these currencies, SQLite, JSON, .ics, a tested PostgreSQL loader and a standard-library helper (`spot_date`, `add_business_days`). $19: [buy on Polar](https://buy.polar.sh/polar_cl_9Rkaup8QpzW7cYaFe9nRx0AEiUSxVLMzYyU1K23uuVP) (checkout and tax by Polar, merchant of record). Also in the [All-Access yearly plan](https://buy.polar.sh/polar_cl_xydfuofU72fdp6xSOHFtihAuniUFagYOwR9zf2M03Gl) with every Plainfold data pack.
87
+
88
+ More calendars: [options expiration dates](https://github.com/plainfoldhq/options-expiration-dates), [stock exchange holidays](https://github.com/plainfoldhq/stock-exchange-holidays), [public holidays by country](https://github.com/plainfoldhq/world-public-holidays), [US federal/NYSE/Fed business days](https://github.com/plainfoldhq/us-federal-calendar). Reference pages: [plainfoldhq.github.io](https://plainfoldhq.github.io/).
89
+
90
+ ## License
91
+
92
+ Data in `data/`: CC0 1.0 (public domain). Tests: MIT. See LICENSE.
93
+
94
+ Made by Plainfold, an AI-run business. Issues and corrections: open an issue or email plainfoldhq@proton.me.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/fx_spot_dates/__init__.py
5
+ src/fx_spot_dates/__main__.py
6
+ src/fx_spot_dates.egg-info/PKG-INFO
7
+ src/fx_spot_dates.egg-info/SOURCES.txt
8
+ src/fx_spot_dates.egg-info/dependency_links.txt
9
+ src/fx_spot_dates.egg-info/entry_points.txt
10
+ src/fx_spot_dates.egg-info/top_level.txt
11
+ src/fx_spot_dates/data/coverage_2026_2028.csv
12
+ src/fx_spot_dates/data/settlement_holidays_2026_2028.csv
13
+ tests/test_data.py
14
+ tests/test_package.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ fx-spot-dates = fx_spot_dates:cli
@@ -0,0 +1 @@
1
+ fx_spot_dates
@@ -0,0 +1,54 @@
1
+ """Check the CSVs against QuantLib, an implementation independent of the `holidays` package they come from.
2
+
3
+ pip install QuantLib
4
+ python -m unittest discover -s tests -v
5
+ """
6
+ import csv
7
+ import os
8
+ import unittest
9
+ from datetime import date, timedelta
10
+
11
+ import QuantLib as ql
12
+
13
+ DATA = os.path.join(os.path.dirname(__file__), "..", "data")
14
+ QL = {"USD": ql.UnitedStates(ql.UnitedStates.FederalReserve), "EUR": ql.TARGET(),
15
+ "GBP": ql.UnitedKingdom(ql.UnitedKingdom.Settlement), "JPY": ql.Japan(),
16
+ "AUD": ql.Australia(ql.Australia.Settlement), "NZD": ql.NewZealand()}
17
+
18
+
19
+ def rows(name):
20
+ with open(os.path.join(DATA, name), newline="", encoding="utf-8") as f:
21
+ return list(csv.DictReader(f))
22
+
23
+
24
+ def qd(d):
25
+ return ql.Date(d.day, d.month, d.year)
26
+
27
+
28
+ class Data(unittest.TestCase):
29
+ def test_holidays_match_quantlib(self):
30
+ covered = {(r["currency"], int(r["year"])) for r in rows("coverage_2026_2028.csv") if r["status"] == "covered"}
31
+ got = {(r["currency"], r["date"]) for r in rows("settlement_holidays_2026_2028.csv")}
32
+ for c, y in covered:
33
+ d = date(y, 1, 1)
34
+ while d.year == y:
35
+ if d.weekday() < 5:
36
+ self.assertEqual((c, d.isoformat()) in got, QL[c].isHoliday(qd(d)), (c, d))
37
+ d += timedelta(days=1)
38
+ self.assertTrue(all((c, int(d[:4])) in covered for c, d in got))
39
+
40
+ def test_spot_dates(self):
41
+ one = ql.Period(1, ql.Days)
42
+ for r in rows("fx_spot_dates_2026_2028.csv"):
43
+ a, b = r["pair"][:3], r["pair"][3:]
44
+ t = qd(date.fromisoformat(r["trade_date"]))
45
+ j = ql.JointCalendar(QL[a], QL[b], ql.JoinHolidays)
46
+ if "USD" in (a, b):
47
+ s = j.advance(QL[b if a == "USD" else a].advance(t, one), one)
48
+ else:
49
+ s = ql.JointCalendar(j, QL["USD"], ql.JoinHolidays).adjust(j.advance(t, ql.Period(2, ql.Days)), ql.Following)
50
+ self.assertEqual(date(s.year(), s.month(), s.dayOfMonth()).isoformat(), r["spot_date"], r)
51
+
52
+
53
+ if __name__ == "__main__":
54
+ unittest.main()
@@ -0,0 +1,42 @@
1
+ """The package (src/fx_spot_dates) against the CSVs in data/. Standard library only.
2
+
3
+ PYTHONPATH=src python -m unittest discover -s tests -v
4
+ """
5
+ import csv
6
+ import os
7
+ import sys
8
+ import unittest
9
+ from datetime import date
10
+
11
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
12
+ import fx_spot_dates as fx # noqa: E402
13
+
14
+ DATA = os.path.join(os.path.dirname(__file__), "..", "data")
15
+
16
+
17
+ class Package(unittest.TestCase):
18
+ def test_spot_table(self):
19
+ with open(os.path.join(DATA, "fx_spot_dates_2026_2028.csv"), newline="") as f:
20
+ for r in csv.DictReader(f):
21
+ self.assertEqual(fx.spot_date(r["pair"], r["trade_date"]).isoformat(), r["spot_date"], r)
22
+
23
+ def test_examples(self):
24
+ self.assertEqual(fx.spot_date("USDJPY", "2026-12-29"), date(2027, 1, 4))
25
+ self.assertEqual(fx.spot_date("eur/usd", "2026-12-24"), date(2026, 12, 29))
26
+ self.assertTrue(fx.is_business_day("USD", "2026-07-03"))
27
+ self.assertIn((date(2026, 12, 28), "Boxing Day (observed)"), fx.holidays("GBP", 2026))
28
+
29
+ def test_errors(self):
30
+ with self.assertRaises(fx.NotCovered):
31
+ fx.is_business_day("AUD", "2026-03-02")
32
+ with self.assertRaises(fx.NotCovered):
33
+ fx.spot_date("EURUSD", "2030-01-02")
34
+ with self.assertRaises(ValueError):
35
+ fx.spot_date("EURUSD", "2026-12-26")
36
+ with self.assertRaises(KeyError):
37
+ fx.is_business_day("CAD", "2026-03-02")
38
+ self.assertEqual(fx.cli(["EURUSD", "2026-12-26"]), 1)
39
+
40
+
41
+ if __name__ == "__main__":
42
+ unittest.main()