|
| 1 | +# Async Migration Gaps and Action Items |
| 2 | + |
| 3 | +## Critical Gaps to Address |
| 4 | + |
| 5 | +### 1. Missing Methods in AsyncProjectX |
| 6 | + |
| 7 | +#### High Priority (Core Functionality): |
| 8 | +- [ ] **`get_account_info()` property**: Sync version has this as a property/method. Async version stores it but doesn't expose it as a property |
| 9 | + - **Action**: Add `@property` for `account_info` in AsyncProjectX |
| 10 | + |
| 11 | +- [ ] **`get_session_token()` property**: Sync exposes JWT token retrieval |
| 12 | + - **Action**: Add `@property` for `session_token` in AsyncProjectX |
| 13 | + |
| 14 | +#### Low Priority (Nice to Have): |
| 15 | +- [ ] **`test_contract_selection()`**: Testing utility |
| 16 | + - **Action**: Consider if needed in async version |
| 17 | + |
| 18 | +### 2. Method Signature Differences |
| 19 | + |
| 20 | +#### Must Fix: |
| 21 | +- [ ] **`get_instrument()`**: Async version missing `live` parameter |
| 22 | + - **Action**: Add `live: bool = False` parameter to async version |
| 23 | + |
| 24 | +- [ ] **`list_accounts()`**: Return type mismatch |
| 25 | + - **Sync**: Returns `list[dict]` |
| 26 | + - **Async**: Returns `list[Account]` |
| 27 | + - **Action**: Verify if this is intentional improvement or needs alignment |
| 28 | + |
| 29 | +### 3. Method Naming Inconsistencies |
| 30 | + |
| 31 | +- [ ] **`get_data()` vs `get_bars()`**: Same functionality, different names |
| 32 | + - **Action**: Consider adding `get_data()` as alias for backwards compatibility |
| 33 | + |
| 34 | +### 4. Authentication Pattern Differences |
| 35 | + |
| 36 | +The async version requires explicit `authenticate()` call while sync does it automatically. |
| 37 | +- **Action**: Document this clearly in migration guide |
| 38 | + |
| 39 | +## Components Verification Status |
| 40 | + |
| 41 | +### ✅ Fully Verified Components: |
| 42 | +1. **Examples**: All 9 examples have working async versions |
| 43 | +2. **Factory Functions**: All have async equivalents in `__init__.py` |
| 44 | + |
| 45 | +### 🔄 Partially Verified Components: |
| 46 | +1. **AsyncProjectX**: Missing some convenience methods/properties |
| 47 | +2. **AsyncOrderManager**: Needs method-by-method verification |
| 48 | +3. **AsyncPositionManager**: Needs method-by-method verification |
| 49 | +4. **AsyncRealtimeDataManager**: Needs method-by-method verification |
| 50 | +5. **AsyncOrderBook**: Refactored into module structure, needs verification |
| 51 | + |
| 52 | +### ❓ Not Yet Verified: |
| 53 | +1. Unit test coverage comparison |
| 54 | +2. Performance benchmarks |
| 55 | +3. Real-world usage patterns |
| 56 | + |
| 57 | +## Immediate Action Items |
| 58 | + |
| 59 | +1. **Add missing properties to AsyncProjectX**: |
| 60 | + ```python |
| 61 | + @property |
| 62 | + def account_info(self) -> Account | None: |
| 63 | + return self._account_info |
| 64 | + |
| 65 | + @property |
| 66 | + def session_token(self) -> str: |
| 67 | + return self._session_token |
| 68 | + ``` |
| 69 | + |
| 70 | +2. **Fix `get_instrument()` signature**: |
| 71 | + ```python |
| 72 | + async def get_instrument(self, symbol: str, live: bool = False) -> Instrument: |
| 73 | + ``` |
| 74 | + |
| 75 | +3. **Create detailed method comparison for remaining components**: |
| 76 | + - AsyncOrderManager vs OrderManager |
| 77 | + - AsyncPositionManager vs PositionManager |
| 78 | + - AsyncRealtimeDataManager vs ProjectXRealtimeDataManager |
| 79 | + - AsyncOrderBook vs OrderBook |
| 80 | + |
| 81 | +## Migration Strategy Recommendations |
| 82 | + |
| 83 | +1. **Phase 1**: Fix critical gaps (properties, method signatures) |
| 84 | +2. **Phase 2**: Add deprecation warnings to sync versions |
| 85 | +3. **Phase 3**: Create comprehensive migration guide with examples |
| 86 | +4. **Phase 4**: Release v2.0.0 with async-only support |
| 87 | + |
| 88 | +## Backwards Compatibility Options |
| 89 | + |
| 90 | +Consider creating sync wrappers for critical methods: |
| 91 | +```python |
| 92 | +def get_data_sync(client: AsyncProjectX, *args, **kwargs): |
| 93 | + """Sync wrapper for backwards compatibility""" |
| 94 | + import asyncio |
| 95 | + return asyncio.run(client.get_bars(*args, **kwargs)) |
| 96 | +``` |
| 97 | + |
| 98 | +## Testing Requirements |
| 99 | + |
| 100 | +Before removing sync versions: |
| 101 | +1. Run all examples with both sync and async |
| 102 | +2. Compare outputs for consistency |
| 103 | +3. Benchmark performance differences |
| 104 | +4. Test error handling scenarios |
| 105 | +5. Verify real-time data handling |
0 commit comments