Broker Options for Live Trading Integration
This document evaluates broker options for connecting mi-casa to live trade execution, covering all five tracked symbols: EUR/USD, XAU/USD (Gold), WTI/USD (Oil), BTC/USD, and ETH/USD.
Background
mi-casa currently sources market data from Twelve Data (REST polling) and Yahoo Finance — both read-only. No broker is connected. The next step is to wire in a live broker for order execution and to consolidate real-time streaming and historical data.
Requirements
| # | Requirement | Detail |
|---|---|---|
| 1 | Trade execution | REST API for placing/cancelling orders |
| 2 | Historical data | Candle history to backfill TimescaleDB |
| 3 | Real-time prices | WebSocket or streaming endpoint for live chart updates |
Option 1 — Oanda ⭐ Recommended
Oanda is a regulated forex/CFD broker with a purpose-built developer API. It covers four of the five tracked symbols natively, with crypto availability depending on region.
Coverage
| Symbol | Supported | Notes |
|---|---|---|
| EUR/USD | ✅ | First-class forex pair |
| XAU/USD | ✅ | Offered as a CFD |
| WTI/USD | ✅ | Offered as a CFD |
| BTC/USD | ⚠️ | Available in some regions; verify for your account jurisdiction |
| ETH/USD | ⚠️ | Same regional caveat as BTC |
API
- REST v20 API — order management, account state, candle history (
GET /v3/instruments/{instrument}/candles) - Streaming API — persistent HTTP connection that pushes price ticks and account events in real time; acts as a drop-in replacement for WebSocket polling
Pros
- Designed for algorithmic/programmatic trading from day one
- Clean, well-documented REST + streaming model
- Generous historical candles (granularities: S5 → M, H1 → W) — sufficient to backfill TimescaleDB
- Sandbox (practice) environment available for development and testing
- No local gateway process required — pure HTTPS calls
Cons
- Crypto coverage is limited and region-dependent; BTC/ETH may not be available in all jurisdictions
- CFD products (XAU, WTI) carry overnight financing costs — relevant if holding positions
- Not suitable as a single broker if full crypto execution is required
Option 2 — Interactive Brokers (IBKR)
IBKR is a multi-asset broker covering every symbol tracked by mi-casa under one account and API.
Coverage
| Symbol | Supported | Notes |
|---|---|---|
| EUR/USD | ✅ | Spot forex |
| XAU/USD | ✅ | Futures or CFD |
| WTI/USD | ✅ | Futures or CFD |
| BTC/USD | ✅ | Via IBKR Crypto |
| ETH/USD | ✅ | Via IBKR Crypto |
API options
| API | Transport | Complexity |
|---|---|---|
| TWS API (socket-based) | TCP socket to local TWS/Gateway process | High |
| Client Portal API | REST + WebSocket; no TWS required | Medium |
Pros
- Single broker for all five asset classes — eliminates the split-broker problem
- Deep historical data across all instruments
- Client Portal API is REST-native and supports WebSocket streaming
- Large community, extensive third-party libraries (e.g.,
ib_insyncfor Python)
Cons
- Integration friction: TWS API requires Trader Workstation or IB Gateway running locally or on a hosted VM — an extra operational dependency
- Client Portal API is simpler but still more complex to auth than Oanda’s token-based flow
- Account minimums and regulatory requirements are more demanding than Oanda
- Documentation is dense; getting a working connection takes longer than Oanda
Option 3 — Split Approach (Pragmatic Alternative)
Rather than choosing one broker to do everything, this approach keeps concerns separated: a data provider handles pricing/history, while dedicated brokers handle execution per asset class.
Architecture
┌─────────────────────────────────────────────┐
│ mi-casa │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Data Pipeline │ │ Order Execution │ │
│ │ │ │ │ │
│ │ Twelve Data │ │ Oanda │ │
│ │ (or Polygon) │ │ EUR/USD │ │
│ │ │ │ XAU/USD │ │
│ │ All 5 symbols │ │ WTI/USD │ │
│ │ REST + WS │ ├─────────────────┤ │
│ │ │ │ Binance │ │
│ └─────────────────┘ │ BTC/USD │ │
│ │ ETH/USD │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────┘
Why Polygon.io instead of Twelve Data?
Polygon.io is an alternative data provider worth evaluating alongside Twelve Data:
- WebSocket streaming for forex, crypto, and equities under one subscription
- REST endpoints for historical aggregates map cleanly onto TimescaleDB ingestion
- Per-symbol pricing may be more cost-effective at scale
Twelve Data remains a valid choice if the existing integration is stable.
Pros
- Clean separation of concerns — data pipeline is independent of broker choice
- Oanda and Binance are both well-suited to programmatic trading
- Binance provides the deepest crypto liquidity and most complete WebSocket API for BTC/ETH
- Easier to swap out individual components without rewiring the whole stack
Cons
- Two broker integrations to maintain instead of one
- Two sets of credentials, rate limits, and error-handling surface areas
- Order routing logic must know which broker to call for each symbol class
- Adds operational complexity to deployments and monitoring
Comparison Summary
| Criterion | Oanda | IBKR | Split (Oanda + Binance) |
|---|---|---|---|
| Forex (EUR/USD) | ✅ | ✅ | ✅ Oanda |
| Commodities (XAU, WTI) | ✅ | ✅ | ✅ Oanda |
| Crypto (BTC, ETH) | ⚠️ Regional | ✅ | ✅ Binance |
| API simplicity | ✅ High | ⚠️ Medium | ⚠️ Medium |
| Historical data | ✅ Sufficient | ✅ Deep | ✅ Via data provider |
| Real-time streaming | ✅ HTTP stream | ✅ WS | ✅ Both |
| Local gateway required | ❌ No | ⚠️ TWS API: Yes | ❌ No |
| Single integration | ✅ Yes | ✅ Yes | ❌ No |
| Integration effort | Low | High | Medium |
Recommendation
Start with Oanda. It covers forex and commodities — the four symbols with the strongest signal pipeline today — with the cleanest developer experience and no local gateway dependency. Use the Oanda sandbox to build and test the full execution loop before going live.
Add Binance later once the Oanda integration is stable and crypto execution becomes a priority. Binance’s WebSocket API is best-in-class for BTC/ETH real-time data and its REST API for order execution is straightforward.
Consider IBKR if the project outgrows the split model and a single unified broker account is operationally preferable — particularly if futures-based commodity exposure (rather than CFDs) becomes a requirement.
Related
- OHLC Feature Enhancements — BTC/ETH symbols, live alerts
- OHLC Phase 2 — Actionability & Observability — paper portfolio feature
- Database Schema — TimescaleDB tables relevant to OHLC ingestion