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

#RequirementDetail
1Trade executionREST API for placing/cancelling orders
2Historical dataCandle history to backfill TimescaleDB
3Real-time pricesWebSocket or streaming endpoint for live chart updates

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

SymbolSupportedNotes
EUR/USDFirst-class forex pair
XAU/USDOffered as a CFD
WTI/USDOffered 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

SymbolSupportedNotes
EUR/USDSpot forex
XAU/USDFutures or CFD
WTI/USDFutures or CFD
BTC/USDVia IBKR Crypto
ETH/USDVia IBKR Crypto

API options

APITransportComplexity
TWS API (socket-based)TCP socket to local TWS/Gateway processHigh
Client Portal APIREST + WebSocket; no TWS requiredMedium

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_insync for 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

CriterionOandaIBKRSplit (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 effortLowHighMedium

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.