Standard financial dates
Project description
finance dates
Fast date ranges, holiday calendars, and trading hours for financial markets
Overview
finance-dates provides calendar-aware date utilities for the
finance-* stack. The Rust core handles holiday-rule expansion,
weekend observance, early closes, and DST-aware regular and extended
trading sessions; the Python package exposes a compact API for date
series, exchange calendars, and open/close timestamps.
The library is useful when you need to answer questions like:
- What are the valid trading dates for NYSE between two dates?
- Which dates in a range are holidays or otherwise invalid for a venue?
- Is a UTC timestamp inside a market session after DST and early closes?
- What are the UTC open/close datetimes for regular and extended trading windows?
Quick start
from datetime import date, datetime, timezone
from finance_dates import Calendar
c = Calendar.from_range(start=date(2024, 1, 1), end=date(2024, 1, 5))
# Inclusive plain calendar dates.
c.days()
# Mon-Fri only, holiday-blind.
c.business_days()
# Exchange-aware calendar with holidays, sessions, and early closes.
nyse = Calendar.from_exchange("XNYS")
nyse.business_days(date(2024, 7, 1), date(2024, 7, 5))
nyse.holidays(date(2024, 7, 1), date(2024, 9, 30))
nyse.sessions(date(2024, 7, 1), date(2024, 7, 5))
nyse.extended_sessions(date(2024, 7, 1), date(2024, 7, 5))
nyse.is_open(datetime(2024, 3, 11, 13, 30, tzinfo=timezone.utc))
For US equity calendars, regular_sessions contains the standard
09:30-16:00 New York session template, while extended_hours includes
pre_open and after_close templates. On early-close days, the
after-close window begins at the early close.
Exchange and region calendars
Calendars can be resolved by exchange/MIC code or by broad region code:
from finance_dates import Calendar, EXCHANGE_CODES, REGION_CODES
Calendar.from_exchange("XLON") # London Stock Exchange
Calendar.from_exchange("XCME") # CME futures-style overnight sessions
Calendar.from_exchange("FOREX") # 24x5 FX family
Calendar.from_region("US") # representative US equity calendar
"XNYS" in EXCHANGE_CODES
"BR" in REGION_CODES
EXCHANGE_CODES is sourced from finance-enums, so the enum package is
the source of truth for supported exchange identifiers.
Documentation
See the Calendars page for supported concepts, market families, date-series patterns, and trading-hours conventions. See the API page for the public Python API and recipes.
Rust crate
The Rust library crate is published as finance-dates and imported as
finance_dates in Rust code:
[dependencies]
finance-dates = "0.1.0"
use finance_dates::{calendar_for_exchange, date_range};
[!NOTE] This library was generated using copier from the Base Python Project Template repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file finance_dates-0.1.0.tar.gz.
File metadata
- Download URL: finance_dates-0.1.0.tar.gz
- Upload date:
- Size: 49.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
262c9244443d918b9ba2148df50203023de46d5770ffb8d0cbefefe95c519ea0
|
|
| MD5 |
30724ae3ff2b7fbf18a5bdef6b6c6ac7
|
|
| BLAKE2b-256 |
e558de75505b5e52db962a06d78f38013ae25099185276740268f372b9472b6f
|
File details
Details for the file finance_dates-0.1.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: finance_dates-0.1.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 298.8 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e12f0c6738d4050040814dfd1bc5c4a0551e5752fe5b595d2e5044d4f370afd
|
|
| MD5 |
1063e09c7f1cdcf9fcdb852ed5129e25
|
|
| BLAKE2b-256 |
8b658f05b5571212c4255167889570e8ca7bc179608d24969f02929fbc8b04d2
|
File details
Details for the file finance_dates-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: finance_dates-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 478.2 kB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e695bceaabb193fd4c4c994bd1415534cb6abae9b6c96b1df8f3ac7f5fbb64e5
|
|
| MD5 |
538a79473f0809a10aa7ecb1dc8c81b4
|
|
| BLAKE2b-256 |
a1ee74899d64497edf65b403c30060083cc092a53053f8f938377d995688217a
|
File details
Details for the file finance_dates-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: finance_dates-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 393.2 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3376b40720bedc68988ce3dc11b33e49b10a330c41aa576e347dd7912c2a40f
|
|
| MD5 |
26c7e850fbeff43366757ef6fc42aa34
|
|
| BLAKE2b-256 |
72f1b2f37b350b7bb250031c344b0c07d9fd553fe01efa5ab85597ba333cac31
|