Twelve Data
API for stocks, forex, crypto. Technical indicators, WebSocket. Free tier.
Overview
Twelve Data is a financial data API providing real-time and historical data for stocks, forex, crypto, ETFs, indices, and commodities. It covers 50+ global exchanges and is known for a developer-friendly experience with built-in technical indicator calculations. Unlike data warehouses that require heavy lifting, Twelve Data abstracts away the complexity—you request data and indicators are pre-calculated on their servers, ready to use immediately in your trading workflows.
Who Uses Twelve Data
Day traders rely on Twelve Data's 1-minute bars and WebSocket streaming for tick-by-tick price updates during market hours. Swing traders use its intraday and daily data to track multi-day patterns without managing separate data pipelines. Quantitative traders leverage batch requests and 100+ server-side indicators to rapidly prototype strategies without building custom calculation layers. Algorithm developers benefit from consistent, adjusted OHLCV data across global exchanges—ensuring backtests reflect real market conditions including splits and dividends. Retail backtesting platforms like StratBase.ai integrate Twelve Data to let traders access institutional-grade data without API management overhead.
Key Features
- Multi-asset coverage: stocks, ETFs, indices, forex pairs, crypto assets, and commodities all from one endpoint
- Technical indicators: 100+ indicators (SMA, EMA, MACD, RSI, Bollinger Bands, Ichimoku, ATR, and more) calculated server-side—no need to implement them yourself
- Time series: 1-minute to monthly intervals with full historical depth; all data adjusted for stock splits and dividends
- WebSocket streaming: real-time quote updates via persistent connection for live trading and intraday monitoring
- Batch requests: query up to 120 symbols in a single API call, reducing round-trip overhead during backtests
- Corporate actions: dividends, splits, earnings dates, insider transactions—critical for accurate historical backtesting
- Logo and metadata: company logos, sector classification, market cap—useful for dashboard context and filtering
- Format flexibility: JSON or CSV output, easy to pipe into Python, R, or Excel workflows
Data Coverage
50+ global exchanges including NYSE, NASDAQ, AMEX, LSE, TSX, ASX, HKEX, Euronext, and Tokyo Stock Exchange. 120,000+ instruments span US equities, European stocks, emerging markets, forex majors and exotics, spot and perpetual crypto, and commodity futures. Historical depth varies by asset class—US equities typically available back to 2005 or earlier, while crypto may start from 2015 onwards.
Practical Trading Scenarios
Scenario 1: Intraday momentum strategy
Fetch 1-minute OHLCV data using WebSocket for real-time updates. Calculate RSI and MACD server-side. Place trades when RSI crosses 70 (overbought) or 30 (oversold) with MACD confirmation. Twelve Data streams quotes in sub-second latency, enabling quick execution windows.
Scenario 2: Multi-timeframe swing trade analysis
Pull daily and 4-hour bars for the same stock. Detect higher-timeframe support/resistance using Bollinger Bands (daily) and lower-timeframe entry points using Stochastic Oscillator (4-hour). One batch request retrieves all data; server-side calculation saves computation time.
Scenario 3: Global portfolio rebalancing
Monitor 50+ stocks across NYSE, LSE, and TSX simultaneously. Use batch endpoints to fetch current prices and calculate position weighting. Trigger rebalancing when allocations drift beyond threshold. Real-time WebSocket updates ensure you don't miss critical levels.
Scenario 4: Dividend-adjusted strategy backtest
Backtest a covered call strategy on dividend-paying stocks. Twelve Data returns split-adjusted and dividend-adjusted closing prices, ensuring your historical P&L matches reality. Insider transaction data reveals filing activity ahead of earnings surprises.
API Details
| Feature | Details |
|---------|---------|
| Base URL | https://api.twelvedata.com |
| Auth | API key via apikey parameter or header |
| Rate Limit | 8 calls/min (free), 800/min (pro) |
| Format | JSON, CSV |
| WebSocket | wss://ws.twelvedata.com |
| Core Endpoints | /time_series, /technical_indicators, /quote, /price, /intraday |
| Historical Depth | Varies by exchange; US equities typically 20+ years |
| Latency | Real-time quotes within 100–500ms, EOD updates 5–30min after close |
Pricing
- Free: 800 calls/day, 8 calls/min, end-of-day data only—suitable for learning or weekly portfolio checks
- Grow: $29/month — 6,600 calls/day, intraday data, real-time WebSocket—ideal for active day traders and strategy developers
- Business: $159/month — 66,000 calls/day, all features, priority support—fits quants running multiple backtests daily
- Enterprise: custom pricing — unlimited calls, dedicated infrastructure, SLA guarantees
How Twelve Data Complements StratBase.ai Backtesting
When you backtest on StratBase.ai, you need reliable, consistent historical data. Twelve Data integration eliminates manual CSV imports and data quality questions. StratBase.ai can pull OHLCV and technical indicators directly from Twelve Data, ensuring your backtests run on clean, split-adjusted, dividend-adjusted data. This means:
- Faster backtests: pre-calculated indicators (RSI, MACD, Bollinger Bands) reduce computation load on the StratBase engine
- Accurate results: dividend and split adjustments baked into Twelve Data ensure historical returns match reality
- Multi-asset testing: easily backtest strategies across stocks, forex, and crypto without switching data providers
- Real-to-backtest handoff: if your strategy uses the same indicators and timeframes on Twelve Data live quotes, your live trading performance matches backtest assumptions
Rather than downloading static CSVs, your StratBase strategy definitions can reference Twelve Data endpoints, keeping data fresh and enabling reproducible, audit-ready backtests.
Getting Started
- Register at twelvedata.com
- Get your API key from the dashboard
- Choose your plan (Grow recommended for active backtesting)
- Use
/time_seriesendpoint for OHLCV data in your backtest setup - Use
/technical_indicatorsfor pre-calculated signals (eliminates redundant math) - Test with the free tier; upgrade once you exceed 800 calls/day
- Connect your key to StratBase.ai to stream live data alongside backtests

