6个版本
0.3.4 | 2023年3月27日 |
---|---|
0.2.4 | 2023年3月8日 |
0.2.3 | 2022年8月11日 |
#115 在 金融
26 每月下载
26KB
589 代码行
usec
这是一个Rust模块,具有计算美国证券交易所包含完整和半天假期的日历的能力。我从https://github.com/xemwebe/cal-calc中大量借鉴了代码,特别感谢https://github.com/xemwebe
动机
我过去使用
- 存储假期信息的数据库开发过类似的应用程序
- 包含假期信息的dotenv文件作为环境变量
由于每年都需要插入新的数据库记录或更新dotenv文件,我对这两种方法都不满意,因此我采用了这种基于规则的解决方案。
用例
- 直接作为rust模块在依赖美国证券交易所日历信息的其他rust应用程序中使用
- 基于此模块构建微服务,使用流行的rust网络框架(如actix-web)为支持http请求的任何程序提供服务,例如服务的示例用法是在交易日期运行某些业务脚本
示例运行
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
依赖
~1.6–2.6MB
~51K SLoC