22
33This file provides guidance to Google's Gemini models when working with code in this repository.
44
5- ## Project Status: v3.1.1 - Stable Production Release
5+ ## Project Status: v3.1.7 - Stable Production Release
66
77** IMPORTANT** : This project uses a fully asynchronous architecture. All APIs are async-only, optimized for high-performance futures trading.
88
@@ -96,7 +96,7 @@ uv run python -m build # Alternative build command
9696
9797## Project Architecture
9898
99- ### Core Components (v3.0.1 - Multi-file Packages)
99+ ### Core Components (v3.0.2 - Multi-file Packages)
100100
101101** ProjectX Client (` src/project_x_py/client/ ` )**
102102- Main async API client for TopStepX ProjectX Gateway
@@ -166,29 +166,17 @@ uv run python -m build # Alternative build command
166166
167167** Async Factory Functions** : Use async ` create_* ` functions for component initialization:
168168``` python
169- # Async factory pattern (v2 .0.0+)
169+ # TradingSuite - Recommended approach (v3 .0.0+)
170170async def setup_trading ():
171- async with ProjectX.from_env() as client:
172- await client.authenticate()
173-
174- # Create managers with async patterns
175- realtime_client = await create_realtime_client(
176- client.jwt_token,
177- str (client.account_id)
178- )
179-
180- order_manager = create_order_manager(client, realtime_client)
181- position_manager = create_position_manager(client, realtime_client)
182-
183- # Or use the all-in-one factory
184- suite = await create_trading_suite(
185- instrument = " MNQ" ,
186- project_x = client,
187- jwt_token = client.jwt_token,
188- account_id = client.account_id
189- )
190-
191- return suite
171+ # Simple one-line setup with TradingSuite
172+ suite = await TradingSuite.create(
173+ " MNQ" ,
174+ timeframes = [" 1min" , " 5min" ],
175+ features = [" orderbook" ]
176+ )
177+
178+ # Everything is ready - client authenticated, realtime connected
179+ return suite
192180```
193181
194182** Dependency Injection** : Managers receive their dependencies (ProjectX client, realtime client) rather than creating them.
@@ -300,6 +288,34 @@ async with ProjectX.from_env() as client:
300288
301289## Recent Changes
302290
291+ ### v3.1.7 - Latest Release
292+ - Minor updates and improvements
293+ - Documentation enhancements
294+
295+ ### v3.1.6 - Critical Deadlock Fix
296+ - ** Fixed** : Deadlock when calling ` suite.data ` methods from event handler callbacks (Issue #39 )
297+ - ** Improved** : Event emission now non-blocking to prevent handler deadlocks
298+ - ** Enhanced** : Event triggering moved outside lock scope for better concurrency
299+ - ** Added** : Missing asyncio import in data_processing module
300+ - ** Maintained** : Full API compatibility - no breaking changes
301+
302+ ### v3.1.5 - Enhanced Bar Data Retrieval
303+ - ** Added** : Optional ` start_time ` and ` end_time ` parameters to ` get_bars() ` method
304+ - ** Improved** : Precise time range specification for historical data queries
305+ - ** Enhanced** : Full timezone support with automatic UTC conversion
306+ - ** Maintained** : Complete backward compatibility with existing ` days ` parameter
307+
308+ ### v3.1.4 - WebSocket Connection Fix
309+ - ** Fixed** : Critical WebSocket error with missing ` _use_batching ` attribute
310+ - ** Improved** : Proper mixin initialization in ProjectXRealtimeClient
311+ - ** Enhanced** : More robust real-time connection handling
312+
313+ ### v3.0.2 - Bug Fixes and Improvements
314+ - ** Order Lifecycle Tracking** : Fixed asyncio concurrency and field reference issues
315+ - ** Order Templates** : Fixed instrument lookup to use cached object
316+ - ** Cleanup Functionality** : Added comprehensive order/position cleanup
317+ - ** Documentation** : Updated all docs to reflect current version
318+
303319### v3.0.1 - Production Ready
304320- ** Performance Optimizations** : Enhanced connection pooling and caching
305321- ** Event Bus System** : Unified event handling across all components
@@ -319,29 +335,31 @@ async with ProjectX.from_env() as client:
319335- All core modules organized as packages with focused submodules
320336- Improved code organization and maintainability
321337
322- ### Trading Suite Usage
338+ ### Trading Suite Usage (v3.0.0+)
323339``` python
324340# Complete trading suite with all managers
325- from project_x_py import create_trading_suite
341+ from project_x_py import TradingSuite
326342
327343async def main ():
328- suite = await create_trading_suite (
329- instrument = " MNQ" ,
344+ suite = await TradingSuite.create (
345+ " MNQ" ,
330346 timeframes = [" 1min" , " 5min" ],
331- enable_orderbook = True ,
332- enable_risk_management = True
347+ features = [ " orderbook " , " risk_manager " ] ,
348+ initial_days = 5
333349 )
334350
335351 # All managers are integrated and ready
336- await suite. start()
352+ # No need to call start() - already connected
337353
338354 # Access individual managers
339- order = await suite.order_manager.place_market_order(
340- " MNQ" , 1 , " BUY"
355+ order = await suite.orders.place_market_order(
356+ contract_id = suite.instrument_info.id,
357+ side = 0 , # Buy
358+ size = 1
341359 )
342360
343- position = suite.position_manager .get_position(" MNQ" )
344- bars = suite.data_manager.get_bars( " MNQ " , " 1min" )
361+ position = await suite.positions .get_position(" MNQ" )
362+ bars = await suite.data.get_data( " 1min" )
345363```
346364
347365### Key Async Examples
@@ -351,24 +369,23 @@ async with ProjectX.from_env() as client:
351369 await client.authenticate()
352370 bars = await client.get_bars(" MNQ" , days = 5 )
353371
354- # Real-time data
372+ # Real-time data with TradingSuite
355373async def stream_data ():
356- async with ProjectX.from_env() as client:
357- await client.authenticate()
358-
359- realtime = await create_realtime_client(
360- client.jwt_token,
361- str (client.account_id)
362- )
363-
364- data_manager = create_realtime_data_manager(
365- " MNQ" , client, realtime
366- )
367-
368- # Set up callbacks
369- data_manager.on_bar_received = handle_bar
370-
371- # Start streaming
372- await realtime.connect()
373- await data_manager.start_realtime_feed()
374+ suite = await TradingSuite.create(
375+ " MNQ" ,
376+ timeframes = [" 1min" , " 5min" ]
377+ )
378+
379+ # Register event handlers
380+ from project_x_py import EventType
381+
382+ async def handle_bar (event ):
383+ print (f " New bar: { event.data} " )
384+
385+ await suite.on(EventType.NEW_BAR , handle_bar)
386+
387+ # Data is already streaming
388+ # Access current data
389+ current_price = await suite.data.get_current_price()
390+ bars = await suite.data.get_data(" 1min" )
374391```
0 commit comments