Crates.io | nyse-holiday-cal |
lib.rs | nyse-holiday-cal |
version | 0.2.1 |
source | src |
created_at | 2023-03-25 23:12:14.189057 |
updated_at | 2024-01-12 03:08:17.373228 |
description | NYSE holiday calendar library |
homepage | |
repository | https://gitlab.com/pezcore/nyse-holiday-cal |
max_upload_size | |
id | 820644 |
size | 74,785 |
Library crate for looking up market holiday information as observed by the New York Stock Exchange.
This crate is designed to work with foreign date types which represent dates in
the proleptic Gregorian
calendar. By
default, [chrono::NaiveDate
] is used as the date type, but with optional crate
feature time
enabled, support for [time::Date
] is added as well.
The main interface for looking up holiday and business day information is trait
[HolidayCal
]. This trait is implemented for all supported foreign date types.
The main interface for performing business-day arithmetic is struct
[DeltaBusinessDays
]. This struct represents an integer number of business days
and can be used in arithmetic with supported foreign date types via the Add
and Sub
traits from the standard library.
There are several other holiday calendar crates in the Rust ecosystem, which provide a framework for developing holiday calendar functionality:
However, these crates are ill-suited for implementing NYSE holiday calendars because they all assume that the holiday status of any date can be determined. In general, it is only possible to determine if a date is an NYSE market holiday if it is before 31 December of the year of the latest published official NYSE holiday calendar.
The design of the this create is simple, it maintains a list of observed and
planned market holidays according to NYSE's officially released schedule. This
list of known market holidays defines a range spanning from 1 Jan in the year
[MIN_YEAR
] to 31 December in the year [MAX_YEAR
]. Dates that fall in this
range are considered market holidays if and only if they are equal to one of the
dates in the holiday list. For dates that fall outside this range, it is not
possible to determine whether or not they are NYSE market holidays and so
generally, Err(OutOfRange)
is returned for queries involving such dates.
When the NYSE publishes their market holiday calendar for a new year, the
holidays list will be updated accordingly, [MAX_YEAR
] will be incremented
accordingly, and the patch version of this crate will be incremented.
Typically, NYSE publishes holiday calendars 1-2 years in advance of the current date.