A Python client library for the ProjectX Gateway API, enabling proprietary trading firms and evaluation providers to interact with ProjectX's trading platform programmatically.
DISCLAIMER: This is an unofficial SDK. The author(s) of this package are not affiliated with or endorsed by ProjectX. This is a community-developed tool to interact with their public API.
- Complete coverage of ProjectX Gateway API endpoints
- Support for real-time WebSocket updates via SignalR
- Pythonic interface with proper error handling
- Support for all ProjectX environments
pip install projectx-sdkFor development, you can install with additional tools:
pip install projectx-sdk[dev]fromprojectx_sdkimportProjectXClient, OrderType, OrderSide# Initialize with API keyclient=ProjectXClient(
username="your_username",
api_key="your_api_key",
environment="topstepx"# Or another supported environment
)
# Get all active accountsaccounts=client.accounts.search(only_active_accounts=True)
account_id=accounts[0].idifaccountselseNoneifaccount_id:
# Search for contractscontracts=client.contracts.search(search_text="NQ", live=False)
ifcontracts:
contract_id=contracts[0].id# Place a market orderorder=client.orders.place(
account_id=account_id,
contract_id=contract_id,
type=OrderType.MARKET,
side=OrderSide.BUY,
size=1
)
print(f"Order placed with ID: {order['orderId']}")
# Set up real-time order updatesdefon_order_update(order_data):
print(f"Order update: {order_data}")
client.realtime.user.subscribe_orders(account_id, callback=on_order_update)
client.realtime.start()The SDK supports all ProjectX environments:
| Platform | SDK Key | Tested |
|---|---|---|
| Alpha Ticks | alphaticks | ✅ |
| Blue Guardian | blueguardian | ❓ |
| Blusky | blusky | ❓ |
| E8X | e8x | ❓ |
| Funding Futures | fundingfutures | ❓ |
| The Futures Desk | futuresdesk | ❓ |
| Futures Elite | futureselite | ❓ |
| FXIFY Futures | fxifyfutures | ❓ |
| GoatFunded | goatfunded | ❓ |
| TickTickTrader | tickticktrader | ❓ |
| TopOneFutures | toponefutures | ❓ |
| TopstepX | topstepx | ✅ |
| TX3Funding | tx3funding | ❓ |
Note: ✅ = Tested and confirmed working, ❓ = Not officially tested yet
The SDK is organized into several components:
- Client: The main entry point that provides access to all API functionality
- Authentication: Handles authentication and token management
- Endpoints: Service modules for each API endpoint (accounts, contracts, orders, etc.)
- Models: Data classes for API entities (account, contract, order, etc.)
- Real-time: WebSocket functionality for real-time updates
Clone the repository:
git clone https://github.com/ChristianJStarr/projectx-sdk-python.git cd projectx-sdk-pythonCreate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies:
pip install -e ".[dev]"Set up pre-commit hooks:
pre-commit install
Run the entire test suite:
pytestRun with coverage:
pytest --cov=projectx_sdkRun specific test files:
pytest tests/test_client.pyBlack: Code formatter
black projectx_sdk tests
isort: Import sorter
isort projectx_sdk tests
Flake8: Linter
flake8 projectx_sdk tests
mypy: Type checker
mypy projectx_sdk
Build the package:
python -m buildCheck the distribution:
twine check dist/*Upload to PyPI:
twine upload dist/*Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Run the tests to ensure they pass
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please remember that this is an unofficial SDK and not affiliated with ProjectX.
For detailed information about the ProjectX API that this unofficial SDK interacts with, please visit the ProjectX API Documentation.
This project is licensed under the MIT License - see the LICENSE file for details.