This project provides a streamlined interface to interact with the TopStepX API, including account discovery, order placement, and OCO bracket management and auto contract sizing money management on backend.
To use the API, you’ll need to purchase access and obtain credentials:
username: "your_username"
api_key: "your_api_key"python account_id.pyYou’ll see output like:
First active account ID: 123456
username: "your_username"
api_key: "your_api_key"
account_id: "123456"python tsx_api_server.pyThe server runs on:
http://localhost:5000
Place an OCO bracket with a limit entry order.
{
"symbol": "MYM",
"quantity": 1,
"op": 39500.0,
"tp": 39700.0,
"sl": 39300.0
}Place an OCO bracket with a stop-market entry order.
{
"symbol": "MYM",
"quantity": -1,
"op": 39450.0,
"tp": 39200.0,
"sl": 39600.0
}Place an OCO bracket and cancel linked orders if the entry fails.
{
"symbol": "MYM",
"quantity": 1,
"op": 39500.0,
"tp": 39700.0,
"sl": 39300.0
}python test_oco.pyYou can toggle between limit and stop entry by changing the endpoint in the script.
- ✅ Account discovery
- ✅ Limit and stop-market entry OCO brackets
- ✅ Linked order cancellation logic
- ✅ Configurable contract and credentials
- ✅ Simple RESTful interface via Quart
Feel free to fork, extend, or submit pull requests. This project is designed to be modular and easy to adapt for automated trading workflows.
For API-related issues, visit:
For code questions or enhancements, open an issue or reach out directly.


