Skip to content

Commit 8ae7e45

Browse files
TexasCodingclaude
andcommitted
docs: update all documentation to v3.1.0
- Update docs/index.rst with v3.1.0 features and TradingSuite examples - Modernize docs/quickstart.rst to use TradingSuite instead of factories - Update indicator count from 55+ to 58+ (includes pattern recognition) - Add v3.1.0 performance notes to examples/README.md - Simplify all code examples to use unified TradingSuite interface Key changes: - Replace factory function examples with TradingSuite.create() - Highlight 2-5x performance improvements in v3.1.0 - Update quick start guide for simplified initialization - Ensure all examples reflect current best practices 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent aa421f7 commit 8ae7e45

File tree

3 files changed

+83
-109
lines changed

3 files changed

+83
-109
lines changed

docs/index.rst

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ project-x-py Documentation
1717
:target: https://project-x-py.readthedocs.io/en/latest/?badge=latest
1818
:alt: Documentation Status
1919

20-
**project-x-py** is a high-performance **async Python SDK** for the `ProjectX Trading Platform <https://www.projectx.com/>`_ Gateway API. This library enables developers to build sophisticated trading strategies and applications by providing comprehensive async access to futures trading operations, real-time market data, Level 2 orderbook analysis, and a complete technical analysis suite with 55+ TA-Lib compatible indicators.
20+
**project-x-py** is a high-performance **async Python SDK** for the `ProjectX Trading Platform <https://www.projectx.com/>`_ Gateway API. This library enables developers to build sophisticated trading strategies and applications by providing comprehensive async access to futures trading operations, real-time market data, Level 2 orderbook analysis, and a complete technical analysis suite with 58+ TA-Lib compatible indicators including pattern recognition.
2121

2222
.. note::
23-
**Version 3.0.0**: Complete async architecture with EventBus integration for unified event handling. All components now use factory functions and dependency injection patterns. Enterprise-grade error handling with centralized logging and comprehensive retry mechanisms.
23+
**Version 3.1.0**: High-performance production suite with 2-5x performance improvements. Features memory-mapped overflow storage, orjson integration, WebSocket message batching, and advanced caching with compression. Complete async architecture with unified TradingSuite interface.
2424

2525
.. warning::
2626
**Development Phase**: This project is under active development. New updates may introduce breaking changes without backward compatibility. During this development phase, we prioritize clean, modern code architecture over maintaining legacy implementations.
@@ -47,37 +47,33 @@ Set up your credentials::
4747
Start trading::
4848

4949
import asyncio
50-
from project_x_py import ProjectX
50+
from project_x_py import TradingSuite
5151
from project_x_py.indicators import RSI, SMA, MACD
5252
5353
async def main():
54-
# V3: Create client with async context manager
55-
async with ProjectX.from_env() as client:
56-
await client.authenticate()
57-
58-
# Get market data with technical analysis
59-
data = await client.get_bars('MNQ', days=30, interval=60) # V3: actual symbol
60-
data = RSI(data, period=14) # Add RSI
61-
data = SMA(data, period=20) # Add moving average
62-
data = MACD(data) # Add MACD
63-
64-
# V3: Place an order with JWT authentication
65-
from project_x_py import create_order_manager, create_realtime_client
66-
instrument = await client.get_instrument('MNQ')
67-
68-
# V3: Create realtime client with JWT and account ID
69-
realtime_client = await create_realtime_client(
70-
jwt_token=client.jwt_token,
71-
account_id=str(client.account_id)
72-
)
73-
order_manager = create_order_manager(client, realtime_client)
74-
75-
response = await order_manager.place_limit_order(
76-
contract_id=instrument.id,
77-
side=0,
78-
size=1,
79-
limit_price=21050.0 # V3: realistic MNQ price
80-
)
54+
# V3.1: Use unified TradingSuite for simplified initialization
55+
suite = await TradingSuite.create(
56+
instrument="MNQ",
57+
timeframes=["1min", "5min"],
58+
features=["orderbook", "risk_manager"]
59+
)
60+
61+
# Get market data with technical analysis
62+
data = await suite.client.get_bars('MNQ', days=30, interval=60)
63+
data = RSI(data, period=14) # Add RSI
64+
data = SMA(data, period=20) # Add moving average
65+
data = MACD(data) # Add MACD
66+
67+
# Place an order using the integrated order manager
68+
response = await suite.orders.place_limit_order(
69+
contract_id=suite.instrument.id,
70+
side=0,
71+
size=1,
72+
limit_price=21050.0
73+
)
74+
75+
# Clean up when done
76+
await suite.disconnect()
8177
8278
# Run the async function
8379
asyncio.run(main())
@@ -95,7 +91,7 @@ Key Features
9591
* Async historical OHLCV data with multiple timeframes
9692
* Real-time market data feeds via async WebSocket
9793
* **Level 2 orderbook analysis** with institutional-grade features
98-
* **55+ Technical Indicators** with TA-Lib compatibility (RSI, MACD, Bollinger Bands, etc.)
94+
* **58+ Technical Indicators** with TA-Lib compatibility (RSI, MACD, Bollinger Bands, Pattern Recognition, etc.)
9995
* **Advanced market microstructure** analysis (iceberg detection, order flow, volume profile)
10096

10197
🔧 **Developer Tools**

docs/quickstart.rst

Lines changed: 52 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -81,34 +81,26 @@ Step 4: Place Your First Order
8181

8282
.. code-block:: python
8383
84-
from project_x_py import create_order_manager, create_realtime_client
84+
from project_x_py import TradingSuite
8585
8686
async def place_order():
87-
async with ProjectX.from_env() as client:
88-
await client.authenticate()
89-
90-
# Get instrument details first
91-
instrument = await client.get_instrument('MNQ') # V3: actual symbol
92-
93-
# V3: Create realtime client with JWT token and account ID
94-
realtime_client = await create_realtime_client(
95-
jwt_token=client.jwt_token,
96-
account_id=str(client.account_id)
97-
)
98-
order_manager = create_order_manager(client, realtime_client)
99-
100-
# Place a limit order
101-
response = await order_manager.place_limit_order(
102-
contract_id=instrument.id, # Use instrument ID
103-
side=0, # 0=Buy, 1=Sell
104-
size=1, # 1 contract
105-
limit_price=21050.0 # Limit price (V3: realistic MNQ price)
106-
)
107-
108-
if response.success:
109-
print(f"Order placed! Order ID: {response.orderId}")
110-
else:
111-
print(f"Order failed: {response}")
87+
# V3.1: Use TradingSuite for simplified initialization
88+
suite = await TradingSuite.create("MNQ")
89+
90+
# Place a limit order using the integrated order manager
91+
response = await suite.orders.place_limit_order(
92+
contract_id=suite.instrument.id, # Use pre-loaded instrument ID
93+
side=0, # 0=Buy, 1=Sell
94+
size=1, # 1 contract
95+
limit_price=21050.0 # Limit price
96+
)
97+
98+
if response.success:
99+
print(f"Order placed! Order ID: {response.orderId}")
100+
else:
101+
print(f"Order failed: {response}")
102+
103+
await suite.disconnect()
112104
113105
asyncio.run(place_order())
114106
@@ -117,28 +109,23 @@ Step 5: Monitor Positions
117109

118110
.. code-block:: python
119111
120-
from project_x_py import create_position_manager, create_realtime_client
112+
from project_x_py import TradingSuite
121113
122114
async def monitor_positions():
123-
async with ProjectX.from_env() as client:
124-
await client.authenticate()
125-
126-
# V3: Create realtime client with JWT and account ID
127-
realtime_client = await create_realtime_client(
128-
jwt_token=client.jwt_token,
129-
account_id=str(client.account_id)
130-
)
131-
position_manager = create_position_manager(client, realtime_client)
132-
133-
# Get all open positions
134-
positions = await position_manager.get_all_positions()
135-
for position in positions:
136-
direction = "LONG" if position.side == 0 else "SHORT"
137-
print(f"{position.contract_id}: {direction} {position.size} @ ${position.average_price:.2f}")
138-
139-
# Get portfolio metrics
140-
portfolio = await position_manager.get_portfolio_pnl()
141-
print(f"Total positions: {portfolio['position_count']}")
115+
# V3.1: Use TradingSuite for all components
116+
suite = await TradingSuite.create("MNQ")
117+
118+
# Get all open positions using integrated position manager
119+
positions = await suite.positions.get_all_positions()
120+
for position in positions:
121+
direction = "LONG" if position.side == 0 else "SHORT"
122+
print(f"{position.contract_id}: {direction} {position.size} @ ${position.average_price:.2f}")
123+
124+
# Get portfolio metrics
125+
portfolio = await suite.positions.get_portfolio_pnl()
126+
print(f"Total positions: {portfolio['position_count']}")
127+
128+
await suite.disconnect()
142129
143130
asyncio.run(monitor_positions())
144131
@@ -147,38 +134,27 @@ Step 6: Real-time Data (Optional)
147134

148135
.. code-block:: python
149136
150-
from project_x_py import create_trading_suite
151-
from project_x_py.events import EventBus, EventType
137+
from project_x_py import TradingSuite, EventType
152138
153139
async def setup_realtime():
154-
async with ProjectX.from_env() as client:
155-
await client.authenticate()
156-
157-
# V3: Create complete trading suite with EventBus
158-
suite = await create_trading_suite(
159-
instrument='MNQ', # V3: actual symbol
160-
project_x=client,
161-
jwt_token=client.jwt_token,
162-
account_id=client.account_id,
163-
timeframes=['1min', '5min', '15min']
164-
)
165-
166-
# V3: Register event handlers via EventBus
167-
@suite.event_bus.on(EventType.NEW_BAR)
168-
async def on_new_bar(data):
169-
print(f"New bar: {data['timeframe']} - {data['close']}")
170-
171-
# V3: Connect and start real-time feeds
172-
await suite.realtime_client.connect()
173-
await suite.data_manager.initialize(initial_days=1)
174-
await suite.data_manager.start_realtime_feed()
175-
176-
# V3: Access components directly
177-
live_data = await suite.data_manager.get_data('5min')
178-
print(f"Live data: {len(live_data)} bars")
179-
180-
# Keep running for 60 seconds to collect data
181-
await asyncio.sleep(60)
140+
# V3.1: Use TradingSuite for complete setup
141+
suite = await TradingSuite.create(
142+
instrument='MNQ',
143+
timeframes=['1min', '5min', '15min']
144+
)
145+
146+
# Register event handlers via integrated EventBus
147+
@suite.events.on(EventType.NEW_BAR)
148+
async def on_new_bar(event):
149+
print(f"New bar: {event.data['timeframe']} - {event.data['close']}")
150+
151+
# Access live data (automatically initialized)
152+
live_data = await suite.data.get_data('5min')
153+
print(f"Live data: {len(live_data)} bars")
154+
155+
# Keep running for 60 seconds to collect data
156+
await asyncio.sleep(60)
157+
await suite.disconnect()
182158
183159
asyncio.run(setup_realtime())
184160

examples/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# ProjectX Python SDK Examples
1+
# ProjectX Python SDK Examples (v3.1.0)
22

3-
This directory contains comprehensive working examples demonstrating all major features of the ProjectX Python SDK. All examples use **MNQ (Micro E-mini NASDAQ)** contracts to minimize risk during testing.
3+
This directory contains comprehensive working examples demonstrating all major features of the ProjectX Python SDK v3.1.0. All examples use **MNQ (Micro E-mini NASDAQ)** contracts to minimize risk during testing.
4+
5+
**Note:** Version 3.1.0 includes significant performance improvements with memory-mapped overflow storage, orjson integration, and WebSocket batching for 2-5x performance gains.
46

57
## ⚠️ Important Safety Notice
68

0 commit comments

Comments
 (0)