Thanks to visit codestin.com
Credit goes to lib.rs

#stock-exchange #calendar

usec

A Rust module with the ability of calculating US stock exchange calendar with full and half-day holidays

8 releases

0.3.6 Sep 6, 2025
0.3.5 Jan 14, 2025
0.3.4 Mar 27, 2023
0.2.5 Jan 14, 2025
0.2.3 Aug 11, 2022

#270 in Finance

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

497 downloads per month

MIT license

26KB
587 lines

usec

This is a Rust module with the ability of calculating US stock exchange calendar with full and half-day holidays. I've borrowed code heavily from https://github.com/xemwebe/cal-calc, special thanks to https://github.com/xemwebe

Motivation

I've developped simular applications in the past using:

  1. database that stores holiday information
  2. dotenv file with holiday information as env variable

I was not satisfied with neither approach due to the requirement of having to insert new db records or updating the dotenv file year after year, that's why I came to this rule-based solution.

Use case

  1. Use directly as a rust module in other rust applications that depends on the US Stock exchange calendar information
  2. Build a micro-service based on this module, using popular rust web frameworks such as actix-web to provide service to any programs that supports http requests, example usage of the service is to run certain business scripts on a trading date

Example run

cargo run --example show_year 2022
# just for the fun, supply JSON formatted env variable to add 3/3/2022 into the rules set
ADDITIONAL_RULES='[{"SingularDay": "2022-03-03"}]' cargo run --example show_year 2022

Dependencies

~1.5–2.7MB
~50K SLoC