v3.5.6: Critical Event System and Bracket Order Fixes
🚀 Release v3.5.6
This release includes critical fixes for the multi-instrument event system and significant improvements to bracket order handling, ensuring robust real-time trading operations.
🐛 Bug Fixes
Multi-Instrument Event System
- Fixed event propagation that was preventing
mnq_context.wait_for(EventType.NEW_BAR)from working - Implemented event forwarding from instrument-specific EventBuses to suite-level EventBus
- Added event methods (
on(),once(),off(),wait_for()) directly to InstrumentContext - Resolved isolation issues where events weren't flowing between instruments and the suite
Bracket Order Improvements
- Automatic price alignment: Orders with misaligned prices are now automatically corrected to the nearest valid tick size
- Better user experience: Changed from validation failure to transparent price adjustment
- Smart handling: Prices are aligned silently with logging, preventing order rejections
Example Scripts
- Fixed all 4 advanced trading examples with proper async/await patterns
- Corrected OrderBook API usage with proper method names and parameters
- Fixed real-time data streaming bar data access from events
- Updated TypedDict access to use bracket notation throughout
✅ Testing Improvements
- 30 failing tests fixed to match new correct behavior
- Event system tests updated to verify forwarding functionality
- Price alignment tests modified for auto-correction validation
- InstrumentContext tests updated with required event_bus parameter
📝 Documentation Updates
- Updated all version references to v3.5.6
- Added event forwarding architecture documentation
- Documented automatic price alignment for bracket orders
- Enhanced multi-instrument event handling examples
- Clear v3.5.6+ feature markers in guides
🔧 Technical Changes
Changed
OrderManager.place_order(): Removed duplicate price alignment callsTradingSuite: Added_setup_event_forwarding()method for event bus connectivityInstrumentContext: Now requiresevent_busparameter in constructor
Internal Improvements
- Enhanced WebSocket mocking in tests for better reliability
- Improved test coverage for multi-instrument scenarios
- Better error handling in event propagation
💡 Migration Guide
This release is fully backward compatible. No code changes required for existing implementations.
New Features Available:
# Direct event methods on InstrumentContext (v3.5.6+)
mnq_context = suite["MNQ"]
await mnq_context.on(EventType.NEW_BAR, handler)
await mnq_context.wait_for(EventType.ORDER_FILLED)
# Automatic price alignment for bracket orders
# Misaligned prices are now automatically corrected
bracket = await orders.place_bracket_order(
contract_id=instrument_id,
side=0,
size=1,
entry_price=21000.12, # Will auto-align to 21000.25
stop_offset=25.0,
target_offset=50.0
)📊 Statistics
- Tests Passing: 3110 ✅
- Files Changed: 11
- Insertions: 949
- Deletions: 497
🙏 Acknowledgments
Thanks to all users who reported issues and provided feedback on the event system behavior.
📦 Installation
pip install --upgrade project-x-py==3.5.6Or with uv:
uv add project-x-py==3.5.6🔗 Links
Full Changelog: v3.5.5...v3.5.6