Skip to content

Commit 12b9608

Browse files
committed
file and class renaming
1 parent 4bd030b commit 12b9608

23 files changed

+175
-300
lines changed

examples/01_basic_client_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
This is the foundation for all other async examples.
77
88
Usage:
9-
Run with: uv run examples/async_01_basic_client_connection.py
9+
Run with: uv run examples/01_basic_client_connection.py
1010
Or use test.sh which sets environment variables: ./test.sh
1111
1212
Author: TexasCoding

examples/02_order_management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
Usage:
1919
Run with: ./test.sh (sets environment variables)
20-
Or: uv run examples/async_02_order_management.py
20+
Or: uv run examples/02_order_management.py
2121
2222
Author: TexasCoding
2323
Date: July 2025

examples/03_position_management.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
Usage:
1515
Run with: ./test.sh (sets environment variables)
16-
Or: uv run examples/async_03_position_management.py
16+
Or: uv run examples/03_position_management.py
1717
1818
Author: TexasCoding
1919
Date: July 2025
@@ -30,13 +30,13 @@
3030
create_realtime_client,
3131
setup_logging,
3232
)
33-
from project_x_py.async_realtime_data_manager import AsyncRealtimeDataManager
33+
from project_x_py.realtime_data_manager import RealtimeDataManager
3434

3535

3636
async def get_current_market_price(
3737
client: ProjectX,
3838
symbol="MNQ",
39-
realtime_data_manager: AsyncRealtimeDataManager | None = None,
39+
realtime_data_manager: RealtimeDataManager | None = None,
4040
):
4141
"""Get current market price with async fallback for closed markets."""
4242
# Try to get real-time price first if available

examples/04_realtime_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
Usage:
1616
Run with: ./test.sh (sets environment variables)
17-
Or: uv run examples/async_04_realtime_data.py
17+
Or: uv run examples/04_realtime_data.py
1818
1919
Author: TexasCoding
2020
Date: July 2025
@@ -35,10 +35,10 @@
3535
)
3636

3737
if TYPE_CHECKING:
38-
from project_x_py.async_realtime_data_manager import AsyncRealtimeDataManager
38+
from project_x_py.realtime_data_manager import RealtimeDataManager
3939

4040

41-
async def display_current_prices(data_manager: AsyncRealtimeDataManager):
41+
async def display_current_prices(data_manager: RealtimeDataManager):
4242
"""Display current prices across all timeframes asynchronously."""
4343
print("\n📊 Current Prices:")
4444

examples/05_orderbook_analysis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
- Market imbalance monitoring
1212
- Best bid/ask tracking
1313
14-
Uses MNQ for Level 2 orderbook data with AsyncOrderBook.
14+
Uses MNQ for Level 2 orderbook data with OrderBook.
1515
1616
Usage:
1717
Run with: ./test.sh (sets environment variables)
18-
Or: uv run examples/async_05_orderbook_analysis.py
18+
Or: uv run examples/05_orderbook_analysis.py
1919
2020
Note: This example includes several wait periods:
2121
- 5 seconds for initial data population
@@ -260,8 +260,8 @@ async def monitor_orderbook_feed(orderbook, duration_seconds=60):
260260

261261

262262
async def demonstrate_all_orderbook_methods(orderbook):
263-
"""Comprehensive demonstration of all AsyncOrderBook methods."""
264-
print("\n🔍 Testing all available AsyncOrderBook methods...", flush=True)
263+
"""Comprehensive demonstration of all OrderBook methods."""
264+
print("\n🔍 Testing all available OrderBook methods...", flush=True)
265265
print(
266266
"📝 Note: Some methods may show zero values without live market data connection"
267267
)

examples/06_multi_timeframe_strategy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
Usage:
1717
Run with: ./test.sh (sets environment variables)
18-
Or: uv run examples/async_06_multi_timeframe_strategy.py
18+
Or: uv run examples/06_multi_timeframe_strategy.py
1919
2020
Author: TexasCoding
2121
Date: July 2025
@@ -33,7 +33,7 @@
3333
from project_x_py.indicators import RSI, SMA
3434

3535

36-
class AsyncMultiTimeframeStrategy:
36+
class MultiTimeframeStrategy:
3737
"""
3838
Async multi-timeframe trend following strategy.
3939
@@ -433,7 +433,7 @@ def signal_handler(signum, frame):
433433
await suite["data_manager"].start_realtime_feed()
434434

435435
# Create and configure strategy
436-
strategy = AsyncMultiTimeframeStrategy(
436+
strategy = MultiTimeframeStrategy(
437437
trading_suite=suite,
438438
symbol="MNQ",
439439
max_position_size=2,

examples/07_technical_indicators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
"""
3-
Async Technical Indicators Analysis Example
3+
Technical Indicators Analysis Example
44
55
Demonstrates concurrent technical analysis using async patterns:
66
- Concurrent calculation of multiple indicators
@@ -12,7 +12,7 @@
1212
1313
Usage:
1414
Run with: ./test.sh (sets environment variables)
15-
Or: uv run examples/async_07_technical_indicators.py
15+
Or: uv run examples/07_technical_indicators.py
1616
1717
Author: TexasCoding
1818
Date: July 2025

examples/08_order_and_position_tracking.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
"""
3-
Async Order and Position Tracking Demo
3+
Order and Position Tracking Demo
44
55
This demo script demonstrates the automatic order cleanup functionality when positions are closed,
66
using proper async components (AsyncOrderManager, AsyncPositionManager, AsyncRealtimeDataManager).
@@ -17,7 +17,7 @@
1717
- Concurrent operations for improved performance
1818
1919
Usage:
20-
python examples/async_08_order_and_position_tracking.py
20+
python examples/08_order_and_position_tracking.py
2121
2222
Manual Testing:
2323
- Let the script create a bracket order
@@ -37,8 +37,8 @@
3737
from project_x_py import ProjectX, create_trading_suite
3838

3939

40-
class AsyncOrderPositionDemo:
41-
"""Async demo class for order and position tracking with automatic cleanup."""
40+
class OrderPositionDemo:
41+
"""Demo class for order and position tracking with automatic cleanup."""
4242

4343
def __init__(self):
4444
self.client = None
@@ -443,7 +443,7 @@ async def run(self, client: ProjectX):
443443

444444
async def main():
445445
"""Main async entry point."""
446-
demo = AsyncOrderPositionDemo()
446+
demo = OrderPositionDemo()
447447
try:
448448
async with ProjectX.from_env() as client:
449449
success = await demo.run(client)

src/project_x_py/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,7 @@
2727
__author__ = "TexasCoding"
2828

2929
# Core client classes - renamed from Async* to standard names
30-
from .async_client import AsyncProjectX as ProjectX
31-
from .async_order_manager import AsyncOrderManager as OrderManager
32-
from .async_orderbook import (
33-
AsyncOrderBook as OrderBook,
34-
create_async_orderbook as create_orderbook,
35-
)
36-
from .async_position_manager import AsyncPositionManager as PositionManager
37-
from .async_realtime import AsyncProjectXRealtimeClient as ProjectXRealtimeClient
38-
from .async_realtime_data_manager import AsyncRealtimeDataManager as RealtimeDataManager
30+
from .client import ProjectX
3931

4032
# Configuration management
4133
from .config import (
@@ -88,6 +80,14 @@
8880
ProjectXConfig,
8981
Trade,
9082
)
83+
from .order_manager import OrderManager
84+
from .orderbook import (
85+
OrderBook,
86+
create_orderbook,
87+
)
88+
from .position_manager import PositionManager
89+
from .realtime import ProjectXRealtimeClient as ProjectXRealtimeClient
90+
from .realtime_data_manager import RealtimeDataManager
9191

9292
# Utility functions
9393
from .utils import (
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
)
5959

6060

61-
class AsyncRateLimiter:
61+
class RateLimiter:
6262
"""Simple async rate limiter using sliding window."""
6363

6464
def __init__(self, max_requests: int, window_seconds: int):
@@ -90,7 +90,7 @@ async def acquire(self) -> None:
9090
self.requests.append(now)
9191

9292

93-
class AsyncProjectX:
93+
class ProjectX:
9494
"""
9595
Async core ProjectX client for the ProjectX Python SDK.
9696
@@ -127,10 +127,10 @@ class AsyncProjectX:
127127
Example:
128128
>>> # Basic async SDK usage with environment variables (recommended)
129129
>>> import asyncio
130-
>>> from project_x_py import AsyncProjectX
130+
>>> from project_x_py import ProjectX
131131
>>>
132132
>>> async def main():
133-
>>> async with AsyncProjectX.from_env() as client:
133+
>>> async with ProjectX.from_env() as client:
134134
>>> await client.authenticate()
135135
>>> positions = await client.get_positions()
136136
>>> print(f"Found {len(positions)} positions")
@@ -191,11 +191,11 @@ def __init__(
191191
self.cache_hit_count = 0
192192

193193
# Rate limiting - 100 requests per minute by default
194-
self.rate_limiter = AsyncRateLimiter(max_requests=100, window_seconds=60)
194+
self.rate_limiter = RateLimiter(max_requests=100, window_seconds=60)
195195

196196
self.logger = logging.getLogger(__name__)
197197

198-
async def __aenter__(self) -> "AsyncProjectX":
198+
async def __aenter__(self) -> "ProjectX":
199199
"""Async context manager entry."""
200200
self._client = await self._create_client()
201201
return self
@@ -210,7 +210,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
210210
@asynccontextmanager
211211
async def from_env(
212212
cls, config: ProjectXConfig | None = None, account_name: str | None = None
213-
) -> AsyncGenerator["AsyncProjectX", None]:
213+
) -> AsyncGenerator["ProjectX", None]:
214214
"""
215215
Create async ProjectX client using environment variables (recommended approach).
216216
@@ -229,7 +229,7 @@ async def from_env(
229229
account_name: Optional account name (overrides environment variable)
230230
231231
Yields:
232-
AsyncProjectX: Configured async client instance ready for building trading applications
232+
ProjectX: Configured async client instance ready for building trading applications
233233
234234
Raises:
235235
ValueError: If required environment variables are not set
@@ -245,10 +245,10 @@ async def from_env(
245245
>>>
246246
>>> # Create async client (recommended approach)
247247
>>> import asyncio
248-
>>> from project_x_py import AsyncProjectX
248+
>>> from project_x_py import ProjectX
249249
>>>
250250
>>> async def main():
251-
>>> async with AsyncProjectX.from_env() as client:
251+
>>> async with ProjectX.from_env() as client:
252252
>>> await client.authenticate()
253253
>>> # Use the client...
254254
>>>
@@ -275,7 +275,7 @@ async def from_env(
275275
@asynccontextmanager
276276
async def from_config_file(
277277
cls, config_file: str, account_name: str | None = None
278-
) -> AsyncGenerator["AsyncProjectX", None]:
278+
) -> AsyncGenerator["ProjectX", None]:
279279
"""Create async ProjectX client using a configuration file.
280280
281281
Alternative initialization method that loads configuration and credentials
@@ -294,7 +294,7 @@ async def from_config_file(
294294
specified in the config file.
295295
296296
Yields:
297-
AsyncProjectX: Configured client instance ready for trading operations
297+
ProjectX: Configured client instance ready for trading operations
298298
299299
Raises:
300300
FileNotFoundError: If config file doesn't exist
@@ -312,7 +312,7 @@ async def from_config_file(
312312
... }
313313
>>>
314314
>>> # Use client with config file
315-
>>> async with AsyncProjectX.from_config_file("config.json") as client:
315+
>>> async with ProjectX.from_config_file("config.json") as client:
316316
... await client.authenticate()
317317
... # Client is ready for trading
318318

0 commit comments

Comments
 (0)