v3.5.5: Comprehensive Sessions Module with RTH/ETH Filtering
🎯 Release v3.5.5: Comprehensive Sessions Module
This release delivers a production-ready sessions module with timezone-aware filtering for Regular Trading Hours (RTH) and Extended Trading Hours (ETH), complete with extensive testing and documentation.
✨ Key Features
Session Filtering System
- RTH/ETH Filtering: Intelligent filtering of market data by trading session type
- Timezone-Aware: Proper handling of DST transitions using pytz
- Product Support: Pre-configured sessions for 20+ futures products (ES, NQ, CL, GC, etc.)
- Custom Sessions: Support for user-defined trading hours
- Performance Optimized: LRU cache with TTL, lazy evaluation for large datasets
Session Analytics
- Session Statistics: Volume profiles, price ranges, VWAP calculations per session
- Session Indicators: Technical indicators that respect session boundaries
- Session Comparison: Compare RTH vs ETH performance metrics
- Multi-Instrument: Analyze sessions across multiple instruments simultaneously
🐛 Bug Fixes
- Fixed hardcoded timezone offsets - now uses proper pytz conversion
- Resolved DST transition edge cases
- Fixed CI test timing issues with optimized performance thresholds
- Corrected maintenance break logic consolidation
- Fixed DataFrame boolean evaluation in examples
- Resolved Polars correlation calculation methods
- Added proper type checking for dictionary operations
📊 Testing & Quality
- 163 tests all passing with 88% code coverage
- Performance tests ensure <0.2s for 10,000 session checks
- Mutation testing validates test quality
- Full TDD methodology - tests define specification
- All ruff, mypy, and bandit security checks passing
📚 Documentation
- 5 comprehensive example scripts demonstrating all features
- 935-line README with complete API documentation
- Session guide with detailed RTH/ETH explanations
- Migration examples for existing code
🚀 Performance Improvements
- Cached timezone objects reduce pytz overhead by 40%
- LRU cache with TTL prevents unbounded memory growth
- Lazy evaluation for datasets >100k rows
- Configurable thresholds for performance tuning
💡 Example Usage
from project_x_py.sessions import SessionFilterMixin, SessionType
import polars as pl
# Initialize session filter
session_filter = SessionFilterMixin()
# Filter data to RTH only
rth_data = await session_filter.filter_by_session(
data=market_data,
session_type=SessionType.RTH,
product="ES"
)
# Check if current time is in session
is_trading = session_filter.is_in_session(
timestamp=datetime.now(UTC),
session_type=SessionType.RTH,
product="MNQ"
)📦 Installation
pip install --upgrade project-x-py==3.5.5🔄 Migration Guide
No breaking changes - fully backward compatible. The sessions module is opt-in and doesn't affect existing code.
👥 Contributors
- @TexasCoding - Implementation and testing
- Claude Code - PR review and optimization suggestions
📄 Full Changelog
- feat: Complete sessions module implementation with RTH/ETH filtering
- feat: Session statistics and analytics capabilities
- feat: Multi-instrument session comparison
- fix: Timezone handling with proper pytz usage
- fix: DST transition edge cases
- fix: Performance test thresholds for CI
- docs: Comprehensive examples and documentation
- test: 163 tests with mutation testing validation
- perf: Cached timezone objects and LRU cache implementation
Note: This release maintains full backward compatibility with v3.x. The sessions module is an optional feature that can be adopted incrementally.