Skip to content

Latest commit

Β 

History

History
129 lines (90 loc) Β· 2.54 KB

File metadata and controls

129 lines (90 loc) Β· 2.54 KB

πŸ“ˆ TSX-API Integration

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.

πŸ” API Access

To use the API, you’ll need to purchase access and obtain credentials:

βš™οΈ Setup

Step 1: Create config.yaml

username: "your_username"
api_key: "your_api_key"

Step 2: Discover Your Account ID

python account_id.py

You’ll see output like:

First active account ID: 123456

Step 3: Update config.yaml

username: "your_username"
api_key: "your_api_key"
account_id: "123456"

Atuto OCO Bracket Setting (if use auto oco part/ no need to change if listening)

Alt text

πŸš€ Quart API Server

python tsx_api_server.py

The server runs on:

http://localhost:5000

🧠 Available Endpoints

/place-oco

Place an OCO bracket with a limit entry order.

{
  "symbol": "MYM",
  "quantity": 1,
  "op": 39500.0,
  "tp": 39700.0,
  "sl": 39300.0
}

/place-oco-stop

Place an OCO bracket with a stop-market entry order.

{
  "symbol": "MYM",
  "quantity": -1,
  "op": 39450.0,
  "tp": 39200.0,
  "sl": 39600.0
}

/place-oco-with-cancel

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
}

πŸ§ͺ Testing

python test_oco.py

You can toggle between limit and stop entry by changing the endpoint in the script.

πŸ›  Features

  • βœ… Account discovery
  • βœ… Limit and stop-market entry OCO brackets
  • βœ… Linked order cancellation logic
  • βœ… Configurable contract and credentials
  • βœ… Simple RESTful interface via Quart

🀝 Contributing

Feel free to fork, extend, or submit pull requests. This project is designed to be modular and easy to adapt for automated trading workflows.

πŸ“¬ Support

For API-related issues, visit:

TopStep Support

For code questions or enhancements, open an issue or reach out directly.

πŸ–Ό Screenshots & Demo

UI

Demo