Skip to main content

tradingcalendars

Python client for the TradingCalendars.com API: business days, FX value dates, T+N settlement dates and holidays for FX markets, currency clearing, bank holidays, payment systems (TARGET2, Fedwire, CHAPS…) and stock exchanges, including half days and early closes.

  • 50 currencies, 69 financial centres, 29 payment systems, 61 exchanges (coverage)
  • Maintained from official sources, past and future years
  • Standard library only, Python 3.10+
  • Installs as tradingcalendars-client, imports as tradingcalendars

Install

pip install tradingcalendars-client

Get a free API key (a minute, no card): https://tradingcalendars.com/signup?ref=pypi

Quick start

from tradingcalendars import TradingCalendars

tc = TradingCalendars(api_key="YOUR_API_KEY")   # or set TRADINGCALENDARS_API_KEY

# Spot value date for a EUR/USD trade done on 25 November 2026
tc.fx_value_date("EURUSD", "2026-11-25")
# datetime.date(2026, 11, 27)  -> US Thanksgiving on day 1 does not delay spot (the USD rule)

# T+1 settlement of a NYSE trade done on 24 December 2026
tc.add_business_days("XNYS.SETTLE", "2026-12-24", 1)
# datetime.date(2026, 12, 28)  -> skips Christmas and the weekend

# Is a date open in several calendars at once?
tc.is_business_day(["TARGET2.PAY", "FEDWIRE.PAY"], "2026-12-28")   # True

# Business days between two dates (start counted, end not)
tc.business_days_between(["GBP.FX", "SGD.FX"], "2027-01-01", "2027-02-01")   # 20

# Holidays, with half days and early closes
for h in tc.holidays("XLON.TRADE", start="2026-12-01", end="2026-12-31"):
    print(h.date, h.event, h.early_close_time or "")
# 2026-12-24 Christmas Eve (half day) 12:30
# 2026-12-25 Christmas Day
# 2026-12-28 Boxing Day
# 2026-12-31 New Year's Eve (half day) 12:30

# Is the New York Stock Exchange open right now?
tc.market_status("XNYS")

Every *_details variant (add_business_days_details, is_business_day_details, business_days_between_details, fx_value_date_details, adjust_date_details, schedule_details) returns the full answer, including each skipped day and why.

FX spot and value dates

fx_value_date applies the market's spot conventions for you: T+2 (T+1 for USD/CAD, USD/TRY and USD/PHP), each currency counting its own business days, the USD rule (a US holiday before the value date does not delay spot, except against MXN and the South American currencies), and a cross taking the later of its two spot dates against USD. It uses each currency's FX market calendar (EUR.FX, USD.FX…).

tc.fx_value_date("USD/CAD", "2026-12-24")          # datetime.date(2026, 12, 29): T+1 pair
tc.fx_value_date("EURGBP", "2026-11-24")           # datetime.date(2026, 11, 27): Thanksgiving is
                                                   # a US holiday, so not a value date for a cross
tc.fx_value_date("USDMXN", "2026-11-25")           # datetime.date(2026, 11, 30): against the peso,
                                                   # the US holiday counts
tc.fx_value_date("EURUSD", "2026-11-25", tenor="tom")

answer = tc.fx_value_date_details("EURUSD", "2026-11-25")
answer["joint_calendar_date"]   # '2026-11-30': what a plain count on both calendars gives
for day in answer["days"]:
    print(day["date"], day["counted"], day["closed"])
# 2026-11-26 True {'USD': 'Thanksgiving Day'}
# 2026-11-27 True {}

Try it without code in the free FX value date calculator.

Business day conventions and cash-flow schedules

For swaps, bonds and loans: ISDA conventions on joint calendars, and adjusted schedules with payment and fixing dates. Holidays are stored through 2077, so long-dated trades don't run out of data.

# Saturday 29 May 2027 under modified following, New York + London
tc.adjust_date(["USNYC.BANK", "GBLON.BANK"], "2027-05-29", "modified_following")
# datetime.date(2027, 5, 28)   (following gives 1 June: 31 May is a holiday in both)

# Quarterly schedule, payment 2 days after each period end, fixing 2 London days before start
for p in tc.schedule(["USD.FX", "GBP.FX"], "2026-11-26", "2027-11-26", frequency="3M",
                     payment_lag=2, fixing_lag=2, fixing_calendars=["GBP.FX"]):
    print(p["start"], p["end"], p["payment_date"], p["fixing_date"], p["accrual_days"])
# 2026-11-27 2027-02-26 2027-03-02 2026-11-25 91   <- 26 Nov 2026 is Thanksgiving
# ...

schedule also takes stub (short_front, long_front, short_back, long_back) and end_of_month=True; schedule_details returns warnings and data coverage too.

With pandas or numpy

import pandas as pd

closures = tc.closure_dates("XNYS.TRADE", start="2026-01-01", end="2027-12-31")
nyse_day = pd.offsets.CustomBusinessDay(holidays=closures)
pd.Timestamp("2026-11-25") + 2 * nyse_day   # skips Thanksgiving

Calendar codes

Family Code Example
FX market <ISO 4217>.FX USD.FX, EUR.FX
Currency non-clearing days <ISO 4217>.CLEAR USD.CLEAR
Bank holidays (financial centre) <UN/LOCODE>.BANK GBLON.BANK, USNYC.BANK
Payment systems <SYSTEM>.PAY TARGET2.PAY, FEDWIRE.PAY
Exchange trading <MIC>.TRADE XNYS.TRADE, XLON.TRADE
Exchange settlement <MIC>.SETTLE XNYS.SETTLE

tc.calendars() lists every code your plan covers. Browse them at tradingcalendars.com/coverage.

Errors

AuthenticationError (401/403), NotFoundError (404), RateLimitError (429, resets at midnight UTC) and TradingCalendarsError for anything else. Messages come from the API and say what to do next.

Also available

License

MIT. The data itself is provided under the TradingCalendars.com terms.

Metadata

Release files for tradingcalendars-client 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tradingcalendars-client 0.3.0
File Size Uploaded Provenance Actions
tradingcalendars_client-0.3.0.tar.gz 12.9 kB With provenance Details for tradingcalendars_client-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tradingcalendars-client 0.3.0
File Interpreter ABI Platform Actions
tradingcalendars_client-0.3.0-py3-none-any.whl Python 3 none any Details for tradingcalendars_client-0.3.0-py3-none-any.whl

Total release size: 23.0 kB

Release files / tradingcalendars_client-0.3.0.tar.gz

Download URL tradingcalendars_client-0.3.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
583717f660c62ff5600c9c6d95515518e411eb8728c61e8d370c24cce1a3e8f4
BLAKE2b-256 checksum
How to use checksums
a43da19b0c81e6d98b95af7fc7e9f39773d40122fb467e15f7839d9ba5a9034a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / tradingcalendars_client-0.3.0-py3-none-any.whl

Download URL tradingcalendars_client-0.3.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebe009caf62fad65b0fbca48f187d18f39cfecd7d7aacdec0c97e7e7dbd4631e
BLAKE2b-256 checksum
How to use checksums
d0e927ca096e30c0a9c10d8e5d1456a80ecf7afaedf04d8f56beadf00811c612
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for tradingcalendars-client 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tradingcalendars_client-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page