Skip to content

Commit 0ae60cb

Browse files
committed
docs: Update documentation for TradingSuite features and recent fixes
- Added comprehensive Features section to README with available feature flags - Documented RiskManager integration requirements and position_manager attribute fix - Updated CLAUDE.md with v3.1.13 development changes and Features enum - Added patching_v4 changes to CHANGELOG with all fixes and improvements - Clarified that OrderManager and PositionManager are always included by default
1 parent 16dd217 commit 0ae60cb

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Migration guides will be provided for all breaking changes
1515
- Semantic versioning (MAJOR.MINOR.PATCH) is strictly followed
1616

17+
## [Unreleased] - patching_v4 branch
18+
19+
### Fixed
20+
- **🔧 Bracket Order Fill Detection**: OrderManager now properly detects entry order fills
21+
- Fixed initialization of OrderManager with realtime client for WebSocket callbacks
22+
- Bracket orders now correctly wait for entry fills before placing protective orders
23+
- OCO (One-Cancels-Other) linking properly implemented for stop/target pairs
24+
25+
- **🔄 Circular Dependencies**: Resolved circular dependency between PositionManager and RiskManager
26+
- Made cross-references optional during initialization
27+
- Proper initialization sequence in TradingSuite
28+
29+
- **🎯 RiskManager Integration**: Fixed RiskManager position manager references
30+
- Now correctly sets both `positions` and `position_manager` attributes
31+
- Ensures all risk methods work properly with PositionManager
32+
33+
### Improved
34+
- **✅ Type Safety**: Full mypy compliance with 0 errors
35+
- Added comprehensive protocol definitions for all manager interfaces
36+
- Fixed all async method return type annotations
37+
- Proper type hints for event handlers
38+
39+
- **🧪 Test Suite**: Enhanced test mocking for cross-component dependencies
40+
- Bracket order tests now properly mock all required methods
41+
- Fixed test isolation for mixin testing
42+
43+
### Documentation
44+
- Added comprehensive Features documentation to README
45+
- Updated CLAUDE.md with architectural changes
46+
- Clarified RiskManager feature flag requirements
47+
- Documented available TradingSuite features and their usage
48+
1749
## [3.1.12] - 2025-08-15
1850

1951
### Added

CLAUDE.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ uv run python -m build # Alternative build command
162162
- Async event handlers with priority support
163163
- Built-in event types for all trading events
164164

165+
### Available TradingSuite Features
166+
167+
The `Features` enum defines optional components that can be enabled:
168+
169+
- `ORDERBOOK = "orderbook"` - Level 2 market depth and analysis
170+
- `RISK_MANAGER = "risk_manager"` - Position sizing and risk management
171+
- `TRADE_JOURNAL = "trade_journal"` - Trade logging (future)
172+
- `PERFORMANCE_ANALYTICS = "performance_analytics"` - Advanced metrics (future)
173+
- `AUTO_RECONNECT = "auto_reconnect"` - Automatic reconnection (future)
174+
175+
**Note**: OrderManager and PositionManager are always included by default.
176+
165177
### Architecture Patterns
166178

167179
**Async Factory Functions**: Use async `create_*` functions for component initialization:
@@ -288,6 +300,14 @@ async with ProjectX.from_env() as client:
288300

289301
## Recent Changes
290302

303+
### v3.1.13 - Current Development (patching_v4)
304+
- **Fixed**: Bracket order fill detection through proper WebSocket callback initialization
305+
- **Fixed**: Circular dependencies between PositionManager and RiskManager
306+
- **Fixed**: RiskManager integration now properly sets both `positions` and `position_manager` attributes
307+
- **Enhanced**: Full mypy type checking compliance with 0 errors
308+
- **Added**: Comprehensive protocol definitions for all manager interfaces
309+
- **Updated**: Test suite to properly mock cross-component dependencies
310+
291311
### v3.1.12 - Latest Release
292312
- **Enhanced**: Significantly improved `01_events_with_on.py` real-time data example
293313
- Added CSV export functionality with interactive prompts
@@ -375,7 +395,7 @@ async def main():
375395
suite = await TradingSuite.create(
376396
"MNQ",
377397
timeframes=["1min", "5min"],
378-
features=["orderbook", "risk_manager"],
398+
features=["orderbook", "risk_manager"], # Optional features
379399
initial_days=5
380400
)
381401

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,38 @@ Or use a config file (`~/.config/projectx/config.json`):
251251
}
252252
```
253253

254+
### Available Features
255+
256+
TradingSuite supports optional features that can be enabled during initialization:
257+
258+
| Feature | String Value | Description |
259+
|---------|-------------|-------------|
260+
| **OrderBook** | `"orderbook"` | Level 2 market depth, bid/ask analysis, iceberg detection |
261+
| **Risk Manager** | `"risk_manager"` | Position sizing, risk validation, managed trades |
262+
| **Trade Journal** | `"trade_journal"` | Trade logging and performance tracking (future) |
263+
| **Performance Analytics** | `"performance_analytics"` | Advanced metrics and analysis (future) |
264+
| **Auto Reconnect** | `"auto_reconnect"` | Automatic WebSocket reconnection (future) |
265+
266+
**Note:** PositionManager and OrderManager are always included and don't require feature flags.
267+
268+
```python
269+
# Enable specific features
270+
suite = await TradingSuite.create(
271+
"MNQ",
272+
features=["orderbook", "risk_manager"]
273+
)
274+
275+
# Access feature-specific components
276+
if suite.orderbook: # Only available when orderbook feature is enabled
277+
spread = await suite.orderbook.get_bid_ask_spread()
278+
279+
if suite.risk_manager: # Only available when risk_manager feature is enabled
280+
sizing = await suite.risk_manager.calculate_position_size(
281+
entry_price=100.0,
282+
stop_loss=99.0
283+
)
284+
```
285+
254286
### Component Overview
255287

256288
#### ProjectX Client
@@ -296,11 +328,19 @@ icebergs = await suite.orderbook.detect_iceberg_orders()
296328
```
297329

298330
#### RiskManager
299-
Risk management and managed trades (when enabled):
331+
Risk management and managed trades (requires feature flag):
300332
```python
301333
# Enable risk manager in features
302334
suite = await TradingSuite.create("MNQ", features=["risk_manager"])
303335

336+
# Risk manager integrates with PositionManager automatically
337+
# Use for position sizing and risk validation
338+
sizing = await suite.risk_manager.calculate_position_size(
339+
entry_price=100.0,
340+
stop_loss=99.0,
341+
risk_percent=0.02 # Risk 2% of account
342+
)
343+
304344
# Use managed trades for automatic risk management
305345
async with suite.managed_trade(max_risk_percent=0.01) as trade:
306346
# Market price fetched automatically (v3.1.11+)
@@ -310,6 +350,8 @@ async with suite.managed_trade(max_risk_percent=0.01) as trade:
310350
)
311351
```
312352

353+
**Note:** RiskManager requires the `"risk_manager"` feature flag and automatically integrates with PositionManager for comprehensive risk tracking.
354+
313355
### Technical Indicators
314356

315357
All 58+ indicators work with async data pipelines:

0 commit comments

Comments
 (0)