Trading API
To write a strategy, reach for the tektii Python SDK and the Writing a Strategy guide — the SDK handles the connection, decodes the event stream, and encodes your orders, so a strategy is plain Python. The REST + WebSocket protocol documented here is the low-level wire protocol underneath; reach for it only when you're porting a client to a language the SDK doesn't ship, not to write a strategy.
The Trading API is the wire protocol your strategy speaks to the Trading Gateway. The same protocol covers all three Gateway modes — backtest, paper, and live — so strategy code stays identical as you promote from simulation to real markets.
Your strategy opens a WebSocket connection to :8080/v1/ws to receive market events (ticks, bars, fills, position updates) and uses REST endpoints at :8080/v1/* to place, modify, and cancel orders. See Concepts for the full architectural picture, including how the Gateway maps a single normalised order model onto each broker's native API.
Get started
- Concepts — Unified protocol, execution modes, connection model
- Connection — Authenticate and connect your strategy
- Hello World — Your first strategy: the SDK path in Python, plus the raw protocol in four more languages
Reference
| Page | Purpose |
|---|---|
| Orders | Order types, statuses, and request/response schemas |
| Positions | Position schema, P&L calculation, and REST endpoints |
| Events | WebSocket event types, market data, and client messages |
| Instruments | Asset classes, provider-native symbol formats, and symbol discovery |
| WebSocket | WebSocket message types: subscriptions, heartbeats, acknowledgments |
| REST | REST endpoints for orders, positions, trades, account, and market data |
| Placing Orders | Worked example: submit market, limit, and stop-loss orders |
| Handling Events | Worked example: route and handle WebSocket events |
The Trading API is implemented by the Trading Gateway. To run a Gateway, follow the setup guide.