Skip to content

Commit 33f8ab1

Browse files
TexasCodingclaude
andcommitted
Update documentation for v3.5.6 release
- Updated version references from v3.3.4/v3.5.5 to v3.5.6 - Added event forwarding architecture details in trading-suite.md - Documented automatic price alignment for bracket orders - Explained multi-instrument event handling with forwarding - Added notes about InstrumentContext event methods (on, once, off, wait_for) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 3012521 commit 33f8ab1

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

docs/examples/advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Advanced Trading Examples
22

3-
This page demonstrates sophisticated trading strategies and advanced features of the ProjectX Python SDK v3.3.4. These examples include order placement, risk management, and complex event-driven trading systems.
3+
This page demonstrates sophisticated trading strategies and advanced features of the ProjectX Python SDK v3.5.6. These examples include order placement with automatic price alignment, risk management, and complex event-driven trading systems with proper multi-instrument event forwarding.
44

55
!!! warning "Live Trading Alert"
66
**These examples place REAL ORDERS on the market!**

docs/examples/realtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Real-time Data Processing Examples
22

3-
This page demonstrates how to work with real-time market data streams using the ProjectX Python SDK v3.3.4. Learn to handle WebSocket data, process multiple timeframes, and build real-time trading systems.
3+
This page demonstrates how to work with real-time market data streams using the ProjectX Python SDK v3.5.6. Learn to handle WebSocket data, process multiple timeframes, and build real-time trading systems with the enhanced event system.
44

55
## Prerequisites
66

docs/guide/realtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Real-time Data Guide
22

3-
This guide covers comprehensive real-time data streaming using ProjectX Python SDK v3.3.4+. All real-time operations are fully asynchronous and provide high-performance WebSocket connectivity with automatic reconnection and memory management.
3+
This guide covers comprehensive real-time data streaming using ProjectX Python SDK v3.5.6+. All real-time operations are fully asynchronous and provide high-performance WebSocket connectivity with automatic reconnection, memory management, and enhanced event forwarding for multi-instrument support.
44

55
## Overview
66

docs/guide/trading-suite.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,14 @@ async def risk_manager_feature():
538538

539539
## Event Handling
540540

541+
### Event System Architecture (v3.5.6+)
542+
543+
The event system in v3.5.6+ features automatic event forwarding from instrument-specific EventBuses to the suite-level EventBus, enabling flexible event handling patterns:
544+
545+
- **Instrument-level events**: Each instrument has its own EventBus for isolated event handling
546+
- **Suite-level events**: All instrument events are forwarded to the suite EventBus for unified handling
547+
- **Event methods on InstrumentContext**: Direct access to `on()`, `once()`, `off()`, and `wait_for()` methods
548+
541549
### Setting Up Event Handlers
542550

543551
#### Single Instrument Event Handling
@@ -566,11 +574,14 @@ async def event_handling():
566574
print(f" New size: {position.size}")
567575
print(f" Unrealized P&L: ${position.unrealized_pnl:.2f}")
568576

569-
# Register event handlers for MNQ
577+
# Register event handlers directly on instrument context (v3.5.6+)
570578
await mnq.on(EventType.NEW_BAR, on_new_bar)
571579
await mnq.on(EventType.ORDER_FILLED, on_order_filled)
572580
await mnq.on(EventType.POSITION_CHANGED, on_position_changed)
573581

582+
# Or use wait_for for specific events (v3.5.6+)
583+
new_bar_event = await mnq.wait_for(EventType.NEW_BAR)
584+
574585
# Keep the application running to receive events
575586
await asyncio.sleep(300) # Run for 5 minutes
576587

@@ -586,7 +597,7 @@ async def multi_instrument_events():
586597
timeframes=["1min", "5min"]
587598
)
588599

589-
# Set up event handlers for each instrument
600+
# Option 1: Register handlers on individual instruments
590601
for symbol, context in suite.items():
591602
# Create symbol-specific handlers using closures
592603
def make_handlers(sym):
@@ -603,12 +614,20 @@ async def multi_instrument_events():
603614

604615
return on_new_bar, on_order_filled, on_position_changed
605616

606-
# Register handlers for this instrument
617+
# Register handlers for this instrument (v3.5.6+ direct methods)
607618
bar_handler, order_handler, position_handler = make_handlers(symbol)
608619
await context.on(EventType.NEW_BAR, bar_handler)
609620
await context.on(EventType.ORDER_FILLED, order_handler)
610621
await context.on(EventType.POSITION_CHANGED, position_handler)
611622

623+
# Option 2: Register a single handler at suite level for all instruments (v3.5.6+)
624+
async def unified_bar_handler(event):
625+
# Events from all instruments are forwarded to suite EventBus
626+
instrument = event.data.get("instrument", "Unknown")
627+
print(f"{instrument} new bar: ${event.data.close:.2f}")
628+
629+
await suite.on(EventType.NEW_BAR, unified_bar_handler)
630+
612631
print("Monitoring events for all instruments...")
613632
await asyncio.sleep(300) # Run for 5 minutes
614633
await suite.disconnect()

0 commit comments

Comments
 (0)