@@ -19,7 +19,7 @@ PROJECT_X_API_KEY="..." PROJECT_X_USERNAME="..." uv run python script.py
1919
2020The test.sh script properly configures all required environment variables. DO NOT attempt to set PROJECT_X_API_KEY or PROJECT_X_USERNAME manually.
2121
22- ## Project Status: v3.2.1 - Statistics and Analytics Overhaul
22+ ## Project Status: v3.3.0 - Complete Statistics Module Redesign
2323
2424** IMPORTANT** : This project uses a fully asynchronous architecture. All APIs are async-only, optimized for high-performance futures trading.
2525
@@ -81,6 +81,279 @@ The standardized deprecation utilities provide:
8181- Metadata tracking for deprecation management
8282- Support for functions, methods, classes, and parameters
8383
84+ ## Specialized Agent Usage Guidelines
85+
86+ ### IMPORTANT: Use Appropriate Subagents for Different Tasks
87+
88+ Claude Code includes specialized agents that should be used PROACTIVELY for specific development tasks. Each agent has specialized knowledge and tools optimized for their domain.
89+
90+ ### When to Use Each Agent
91+
92+ #### ** python-developer**
93+ Use for project-x-py SDK development tasks:
94+ - Writing async trading components (OrderManager, PositionManager, etc.)
95+ - Implementing financial indicators with Polars DataFrames
96+ - Optimizing real-time data processing and WebSocket connections
97+ - Creating new TradingSuite features
98+ - Ensuring 100% async architecture compliance
99+ - Handling Decimal price precision requirements
100+
101+ Example scenarios:
102+ - "Implement a new technical indicator"
103+ - "Add WebSocket reconnection logic"
104+ - "Create async order placement methods"
105+
106+ #### ** code-standards-enforcer**
107+ Use PROACTIVELY for maintaining SDK standards:
108+ - ** ALWAYS check IDE diagnostics first** via ` mcp__ide__getDiagnostics `
109+ - Before committing changes (enforce standards)
110+ - PR review checks
111+ - Release validation
112+ - Verifying 100% async architecture
113+ - Checking TradingSuite patterns compliance
114+ - Ensuring Polars-only DataFrames usage
115+ - Validating deprecation compliance
116+ - Type safety with TypedDict/Protocol
117+
118+ Example scenarios:
119+ - After implementing new features
120+ - Before creating pull requests
121+ - When refactoring existing code
122+ - ** After any code changes** - check IDE diagnostics immediately
123+
124+ #### ** code-refactor**
125+ Use PROACTIVELY for architecture improvements:
126+ - Migrating to TradingSuite patterns
127+ - Optimizing Polars operations
128+ - Consolidating WebSocket handling
129+ - Modernizing async patterns
130+ - Monolithic to modular transitions
131+ - Event system optimization
132+ - Memory management improvements
133+
134+ Example scenarios:
135+ - "Refactor OrderManager to use EventBus"
136+ - "Optimize DataFrame operations in indicators"
137+ - "Migrate legacy sync code to async"
138+
139+ #### ** code-documenter**
140+ Use PROACTIVELY for documentation tasks:
141+ - Documenting new TradingSuite APIs
142+ - Writing indicator function docs
143+ - Explaining WebSocket events
144+ - Creating migration guides
145+ - Maintaining README and examples/
146+ - Writing deprecation notices
147+ - Updating docstrings
148+
149+ Example scenarios:
150+ - After adding new features
151+ - When changing APIs
152+ - Creating example scripts
153+
154+ #### ** code-debugger**
155+ Use PROACTIVELY for troubleshooting:
156+ - WebSocket disconnection issues
157+ - Order lifecycle failures
158+ - Real-time data gaps
159+ - Event deadlocks
160+ - Price precision errors
161+ - Memory leaks
162+ - AsyncIO debugging
163+ - SignalR tracing
164+
165+ Example scenarios:
166+ - "Debug why orders aren't filling"
167+ - "Fix WebSocket reconnection issues"
168+ - "Trace event propagation problems"
169+
170+ #### ** code-reviewer**
171+ Use PROACTIVELY for code review:
172+ - Reviewing async patterns
173+ - Checking real-time performance
174+ - Validating financial data integrity
175+ - Ensuring API stability
176+ - Before releases
177+ - PR reviews
178+
179+ Example scenarios:
180+ - Before merging pull requests
181+ - After completing features
182+ - Before version releases
183+
184+ ### Agent Selection Best Practices
185+
186+ 1 . ** Use agents concurrently** when multiple tasks can be parallelized
187+ 2 . ** Be specific** in task descriptions for agents
188+ 3 . ** Choose the right agent** based on the task type, not just keywords
189+ 4 . ** Use PROACTIVELY** - don't wait for user to request specific agents
190+ 5 . ** Combine agents** for complex tasks (e.g., refactor → standards → review)
191+
192+ ### Example Multi-Agent Workflow
193+
194+ ``` python
195+ # When implementing a new feature:
196+ 1 . python- developer: Implement the feature
197+ 2 . code- standards- enforcer: Verify compliance
198+ 3 . code- documenter: Add documentation
199+ 4 . code- reviewer: Final review before commit
200+ ```
201+
202+ ### Agent Command Requirements
203+
204+ ** Note** : Tool permissions are configured at the system level. This section documents common commands agents need.
205+
206+ #### Commands Agents Typically Use
207+
208+ ** All Agents** :
209+ - ` ./test.sh [script] ` - Run tests and examples with proper environment
210+ - File operations (Read, Write, Edit, MultiEdit)
211+ - ` git status ` , ` git diff ` , ` git add ` - Version control
212+
213+ ** python-developer** :
214+ - ` uv run pytest ` - Run test suite
215+ - ` uv add [package] ` - Add dependencies
216+ - ` ./test.sh examples/*.py ` - Test example scripts
217+
218+ ** code-standards-enforcer** :
219+ - ` mcp__ide__getDiagnostics ` - ** CHECK FIRST** - IDE diagnostics
220+ - ` uv run ruff check . ` - Lint code
221+ - ` uv run ruff format . ` - Format code
222+ - ` uv run mypy src/ ` - Type checking
223+ - ` uv run pytest --cov ` - Coverage reports
224+
225+ ** code-debugger** :
226+ - ` ./test.sh ` with debug scripts
227+ - ` grep ` and search operations
228+ - Log analysis commands
229+
230+ ** code-reviewer** :
231+ - ` git diff ` - Review changes
232+ - ` uv run pytest ` - Verify tests pass
233+ - Static analysis tools
234+
235+ #### Example Agent Command Workflow
236+
237+ ``` bash
238+ # Agent workflow for implementing a feature
239+ 1. python-developer:
240+ - Edit src/project_x_py/new_feature.py
241+ - ./test.sh tests/test_new_feature.py
242+
243+ 2. code-standards-enforcer:
244+ - mcp__ide__getDiagnostics # ALWAYS CHECK FIRST
245+ - uv run ruff check src/
246+ - uv run mypy src/
247+ - Fix any issues found
248+
249+ 3. code-reviewer:
250+ - mcp__ide__getDiagnostics # Verify no issues remain
251+ - git diff
252+ - uv run pytest
253+ - Review implementation
254+ ```
255+
256+ #### IDE Diagnostics Priority
257+
258+ ** CRITICAL** : The ` code-standards-enforcer ` agent must ALWAYS:
259+ 1 . ** First** check ` mcp__ide__getDiagnostics ` for the modified files
260+ 2 . ** Fix** any IDE diagnostic errors/warnings before proceeding
261+ 3 . ** Then** run traditional linting tools (ruff, mypy)
262+ 4 . ** Verify** with IDE diagnostics again after fixes
263+
264+ This catches issues that mypy might miss, such as:
265+ - Incorrect method names (e.g., ` get_statistics ` vs ` get_position_stats ` )
266+ - Missing attributes on classes
267+ - Type mismatches that IDE's type checker detects
268+ - Real-time semantic errors
269+
270+ ### MCP Server Permissions for Agents
271+
272+ ** Note** : MCP server access is system-configured. Agents should have access to relevant MCP servers for their tasks.
273+
274+ #### Essential MCP Servers for Agents
275+
276+ ** All Agents Should Access** :
277+ - ` mcp__aakarsh-sasi-memory-bank-mcp ` - Track progress and context
278+ - ` mcp__mcp-obsidian ` - Document plans and decisions
279+ - ` mcp__smithery-ai-filesystem ` - File operations
280+
281+ ** python-developer** :
282+ - ` mcp__project-x-py_Docs ` - Search project documentation
283+ - ` mcp__upstash-context-7-mcp ` - Get library documentation
284+ - ` mcp__waldzellai-clear-thought ` - Complex problem solving
285+ - ` mcp__itseasy-21-mcp-knowledge-graph ` - Map component relationships
286+
287+ ** code-standards-enforcer** :
288+ - ` mcp__project-x-py_Docs ` - Verify against documentation
289+ - ` mcp__aakarsh-sasi-memory-bank-mcp ` - Check architectural decisions
290+
291+ ** code-refactor** :
292+ - ` mcp__waldzellai-clear-thought ` - Plan refactoring strategy
293+ - ` mcp__itseasy-21-mcp-knowledge-graph ` - Understand dependencies
294+ - ` mcp__aakarsh-sasi-memory-bank-mcp ` - Log refactoring decisions
295+
296+ ** code-documenter** :
297+ - ` mcp__mcp-obsidian ` - Create documentation
298+ - ` mcp__project-x-py_Docs ` - Reference existing docs
299+ - ` mcp__tavily-mcp ` - Research external APIs
300+
301+ ** code-debugger** :
302+ - ` mcp__waldzellai-clear-thought ` - Analyze issues systematically
303+ - ` mcp__itseasy-21-mcp-knowledge-graph ` - Trace data flow
304+ - ` mcp__ide ` - Get diagnostics and errors
305+
306+ ** code-reviewer** :
307+ - ` mcp__github ` - Review PRs and issues
308+ - ` mcp__project-x-py_Docs ` - Verify against standards
309+ - ` mcp__aakarsh-sasi-memory-bank-mcp ` - Check design decisions
310+
311+ #### Example MCP Usage in Agent Workflows
312+
313+ ``` python
314+ # python-developer agent workflow
315+ 1 . Search existing patterns:
316+ await mcp__project_x_py_Docs__search_project_x_py_code(
317+ query = " async def place_order"
318+ )
319+
320+ 2 . Track implementation:
321+ await mcp__aakarsh_sasi_memory_bank_mcp__track_progress(
322+ action = " Implemented async order placement" ,
323+ description = " Added bracket order support"
324+ )
325+
326+ 3 . Document in Obsidian:
327+ await mcp__mcp_obsidian__obsidian_append_content(
328+ filepath = " Development/ProjectX SDK/Features/Order System.md" ,
329+ content = " ## Bracket Order Implementation\n ..."
330+ )
331+
332+ # code-debugger agent workflow
333+ 1 . Analyze problem:
334+ await mcp__waldzellai_clear_thought__clear_thought(
335+ operation = " debugging_approach" ,
336+ prompt = " WebSocket disconnecting under load"
337+ )
338+
339+ 2 . Check component relationships:
340+ await mcp__itseasy_21_mcp_knowledge_graph__search_nodes(
341+ query = " WebSocket RealtimeClient"
342+ )
343+
344+ 3 . Get IDE diagnostics:
345+ await mcp__ide__getDiagnostics()
346+ ```
347+
348+ #### MCP Server Best Practices for Agents
349+
350+ 1 . ** Memory Bank** : Update after completing tasks
351+ 2 . ** Obsidian** : Document multi-session plans and decisions
352+ 3 . ** Clear Thought** : Use for complex analysis and planning
353+ 4 . ** Knowledge Graph** : Maintain component relationships
354+ 5 . ** Project Docs** : Reference before implementing
355+ 6 . ** GitHub** : Check issues and PRs for context
356+
84357## Development Documentation with Obsidian
85358
86359### Important: Use Obsidian for Development Plans and Progress Tracking
@@ -504,7 +777,18 @@ async with ProjectX.from_env() as client:
504777
505778## Recent Changes
506779
507- ### v3.2.1 - Latest Release (2025-08-19)
780+ ### v3.3.0 - Latest Release (2025-01-21)
781+ - ** Breaking** : Complete statistics system redesign with 100% async-first architecture
782+ - ** Added** : New statistics module with BaseStatisticsTracker, ComponentCollector, StatisticsAggregator
783+ - ** Added** : Multi-format export (JSON, Prometheus, CSV, Datadog) with data sanitization
784+ - ** Added** : Enhanced health monitoring with 0-100 scoring and configurable thresholds
785+ - ** Added** : TTL caching, parallel collection, and circular buffers for performance optimization
786+ - ** Added** : 45+ new tests covering all aspects of the async statistics system
787+ - ** Fixed** : Eliminated all statistics-related deadlocks with single RW lock per component
788+ - ** Changed** : All statistics methods now require ` await ` for consistency and performance
789+ - ** Removed** : Legacy statistics mixins (EnhancedStatsTrackingMixin, StatsTrackingMixin)
790+
791+ ### v3.2.1 - Previous Release (2025-08-19)
508792- ** Added** : Complete statistics and analytics system with health monitoring and performance tracking
509793- ** Added** : Fine-grained locking system to prevent deadlocks (replaced single ` _stats_lock ` with category-specific locks)
510794- ** Added** : Consistent synchronous statistics API across all components for thread-safe access
0 commit comments