trading-calendar-0.2.0 has been yanked.
trading-calendar 📅
A comprehensive trading calendar for global financial markets, providing holidays, trading hours, and early close information.
Features
- 🌍 Multiple Markets: NYSE, NASDAQ, LSE, TSE, TSX
- ⏰ Trading Hours: Regular, pre-market, and after-hours sessions
- 📅 Holiday Detection: All market holidays with weekend adjustments
- 🕐 Early Closes: Half-day schedules (Christmas Eve, Black Friday, etc.)
- 🌐 Timezone Support: Automatic handling of market timezones
- 🚀 Performance: Efficient LRU caching
- 🔒 Thread Safe: Concurrent access support
- 📆 2020-2030 Support: Comprehensive holiday calendars
Quick Start
use ;
Supported Markets
| Market | Regular Hours (Local) | Pre-Market | After-Hours | Status |
|---|---|---|---|---|
| NYSE | 9:30 AM - 4:00 PM ET | 4:00 AM - 9:30 AM | 4:00 PM - 8:00 PM | ✅ Full Support |
| NASDAQ | 9:30 AM - 4:00 PM ET | 4:00 AM - 9:30 AM | 4:00 PM - 8:00 PM | ✅ Full Support |
| LSE | 8:00 AM - 4:30 PM GMT | - | - | ✅ Full Support |
| TSE | 9:00 AM - 3:00 PM JST | - | - | ✅ Full Support |
| TSX | 9:30 AM - 4:00 PM ET | - | - | ✅ Full Support |
Thread Safety
The TradingCalendar is thread-safe and can be shared across threads:
use Arc;
use ;
Error Handling
The library uses proper error handling with Result types:
use ;
Performance
The library uses efficient caching to ensure optimal performance:
- Holiday calculations are cached per year using LRU cache
- Thread-safe concurrent access with proper eviction
- Minimal allocations with optimized data structures
Installation
Add this to your Cargo.toml:
[]
= "0.2.0"
Key Methods
use ;
let calendar = new?;
// Check if market is open now
let is_open = calendar.is_open_now?;
// Check if a specific date is a trading day
let is_trading = calendar.is_trading_day?;
// Check if a specific date is a holiday
let is_holiday = calendar.is_holiday?;
// Get next market open time
let next_open = calendar.next_open?;
// Get next market close time
let next_close = calendar.next_close?;
// Get trading hours for a specific date
let hours = calendar.trading_hours;
Examples
See the examples directory for more detailed usage examples:
- Basic Usage - Simple calendar operations
- Check Holidays - Holiday detection
- Holiday Info - Detailed holiday information
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.