BankHoliday 1.1.0

dotnet add package BankHoliday --version 1.1.0
                    
NuGet\Install-Package BankHoliday -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BankHoliday" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BankHoliday" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="BankHoliday" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BankHoliday --version 1.1.0
                    
#r "nuget: BankHoliday, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BankHoliday@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BankHoliday&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=BankHoliday&version=1.1.0
                    
Install as a Cake Tool

BankHoliday

A lightweight .NET library for U.S. stock market holidays and trading hours.

Features

  • Determine if a given date is a trading day
  • Check if the market is currently open (or at any specified DateTime)
  • Market open / close times, including early-close days (1:00 PM ET)
  • Compute next / previous trading days
  • All U.S. equity market holidays: New Year's, MLK Day (from 1998), Presidents Day, Good Friday, Memorial Day, Juneteenth (from 2022), Independence Day, Labor Day, Thanksgiving, Christmas
  • Special closure dates: 9/11, Hurricane Sandy, presidential funerals (Nixon 1994, Reagan 2004, Ford 2007, G.H.W. Bush 2018), Carter National Day of Mourning (2025-01-09)
  • DST change detection between two dates
  • Options expiration helpers: monthly third-Friday and weekly expirations (holiday-adjusted)
  • DateOnly overloads for isHoliday, isWorkingDay, isEarlyCloseDay

Requirements

  • .NET 10.0+

Installation

Install the NuGet package:

dotnet add package BankHoliday

Or include the project in your solution:

<ProjectReference Include="path\to\BankHoliday\BankHoliday.csproj" />

Usage

using BankHolidayNS;

// Is the market open right now?
bool isOpen = BankHoliday.isMarketOpenNow;

// Is a specific date a trading day?
bool isWorkDay = BankHoliday.isWorkingDay(new DateTime(2025, 12, 25)); // false (Christmas)

// Today's close time (handles early-close days)
TimeSpan closeTime = BankHoliday.closeTimeForToday;

// Next / previous trading days
DateTime nextDay = BankHoliday.nextTradingDay;
DateTime prevDay = BankHoliday.prevTradingDay;

// Market status at a specific time (in EST)
BankHoliday.MarketTime status = BankHoliday.checkTime(someDateTime);
// Returns: MarketTime.beforeOpen, MarketTime.open, or MarketTime.afterClose

// Current time in EST
DateTime nowEst = BankHoliday.nowEST;

// All holidays for a year (immutable, cached)
var holidays = BankHoliday.getHolidays(2025);

// Count trading days strictly between two dates
int days = BankHoliday.countWorkingDaysBetweenDates(
    new DateTime(2025, 1, 1), new DateTime(2025, 2, 1));

// Options expirations
DateTime monthly = BankHoliday.thirdFridaySmart(2025, 4); // adjusts for Good Friday
DateTime weekly  = BankHoliday.nextWeeklyOptionsDate(bWeekAheadIfFriday: true);

Methods without a date argument (nextFriday(), nextWeeklyOptionsDate(bool), thirdFridayCurMonth(), ...) use the current date in the Eastern time zone, not the local machine date.

Early Close Days

The library handles early-close days (1:00 PM ET):

  • Day after Thanksgiving
  • Christmas Eve (when Christmas is not on a weekend)
  • July 3rd (when July 4th is not on a weekend)

isEarlyCloseDay is true only on a trading day; getCloseTimeForDate applies the calendar rule as is.

License

MIT — see LICENSE. (c) Vitas Ramanchauskas, SpyTlt.com

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 60 10/5/2026
1.0.0 111 4/28/2026