You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cursorrules
+77-15Lines changed: 77 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
1
# ProjectX Python SDK - Cursor AI Rules
2
2
3
3
## Project Overview
4
-
This is a Python SDK/client library for the ProjectX Trading Platform (https://www.projectx.com/) Gateway API. It provides developers with tools to build sophisticated trading strategies and applications by offering comprehensive access to real-time market data, order management, and market analysis. The SDK uses Polars for data processing and emphasizes performance, accuracy, and real-time capabilities.
4
+
This is an **async-first Python SDK** (v2.0.4) for the ProjectX Trading Platform (https://www.projectx.com/) Gateway API. It provides developers with tools to build sophisticated trading strategies and applications by offering comprehensive async access to real-time market data, order management, and market analysis. The SDK uses Polars for data processing and emphasizes performance, accuracy, and real-time capabilities.
5
5
6
6
**Important**: This is NOT a trading strategy itself - it's a development toolkit that enables the creation of trading strategies that integrate with the ProjectX platform.
7
7
8
+
**Architecture**: As of v2.0.0, this SDK is fully asynchronous with no synchronous APIs. All operations use async/await patterns for optimal performance and concurrency.
9
+
8
10
## ProjectX API Integration Rules
9
11
10
12
### Configurable Platform Endpoints
@@ -41,11 +43,20 @@ This is a Python SDK/client library for the ProjectX Trading Platform (https://w
41
43
42
44
## Code Style & Formatting Rules
43
45
46
+
### Async Patterns (v2.0.0+)
47
+
- **ALWAYS** use `async def` for methods that perform I/O operations
48
+
- **ALWAYS** use `await` when calling async methods
49
+
- **ALWAYS** use `async with` for context managers
50
+
- **NEVER** create synchronous wrappers around async methods
51
+
- **ALWAYS** propagate async patterns through the entire call stack
52
+
- **PREFER** `asyncio.gather()` for concurrent operations
53
+
44
54
### Type Hints
45
55
- **ALWAYS** use modern Python 3.10+ union syntax: `int | None` instead of `Optional[int]`
46
56
- **ALWAYS** use `X | Y` in isinstance calls instead of `(X, Y)` tuples
47
57
- **ALWAYS** include comprehensive type hints for all method parameters and return values
48
58
- **PREFER** `dict[str, Any]` over `Dict[str, Any]`
59
+
- **ALWAYS** use proper async type hints: `Coroutine`, `AsyncIterator`, etc.
49
60
50
61
### Error Handling
51
62
- **ALWAYS** wrap ProjectX API calls in try-catch blocks
@@ -76,12 +87,15 @@ This is a Python SDK/client library for the ProjectX Trading Platform (https://w
76
87
77
88
## Testing & Validation Rules
78
89
79
-
### Test Methods
90
+
### Async Test Methods
91
+
- **ALWAYS** use `@pytest.mark.asyncio` for async test methods
92
+
- **ALWAYS** use `async def test_*` for testing async functionality
80
93
- **ALWAYS** include comprehensive test methods for new features
81
94
- **ALWAYS** test both success and failure scenarios
82
95
- **ALWAYS** validate prerequisites before running tests
83
96
- **ALWAYS** return structured test results with `validation`, `performance_metrics`, and `recommendations`
84
97
- **PREFER** internal test methods over external test files for component validation
98
+
- **ALWAYS** use `aioresponses` for mocking async HTTP calls
85
99
86
100
### Validation Patterns
87
101
- **ALWAYS** implement `_validate_*_payload()` methods for API data
@@ -96,6 +110,8 @@ This is a Python SDK/client library for the ProjectX Trading Platform (https://w
96
110
- **ALWAYS** implement time filtering for all analysis methods
97
111
- **ALWAYS** return comprehensive analysis with metadata
98
112
- **PREFER** confidence scores and statistical validation over simple thresholds
113
+
- **SUPPORT** pattern recognition indicators (FVG, Order Block, WAE)
114
+
- **ENSURE** all indicators work with async data pipelines
99
115
100
116
### Data Consistency
101
117
- **ALWAYS** ensure consistent time windows across related analysis methods
@@ -119,17 +135,30 @@ This is a Python SDK/client library for the ProjectX Trading Platform (https://w
119
135
120
136
## Architecture Rules
121
137
138
+
### Package Structure (v2.0.4+)
139
+
- **ORGANIZED** as multi-file packages for better maintainability:
0 commit comments