Quick answer
Twelve Data is one API for global stocks, ETFs, forex, crypto and indices, with bars from 1 minute to 1 month via /time_series. Authenticate with apikey= or an Authorization: apikey … header; the free Basic plan allows 800 requests a day and 8 per minute, and forex and crypto use BASE/QUOTE symbols such as EUR/USD.
Twelve Data API at a glance
- Pricing
- Free: 800 requests/day, 8/min
- Availability
- Worldwide
- Paper trading
- Not applicable (data only)
- Integration type
- REST + API key
- In AlgoGP
- Built in: data adapter (Pro)
- REST base
https://api.twelvedata.com- Auth
apikeyquery parameter orAuthorization: apikey <key>- Free plan
- 800 requests/day, 8/minute
- Symbols
AAPL,EUR/USD,BTC/USD,SPX
The time_series endpoint
/time_series?symbol=EUR/USD&interval=1h&outputsize=5000&order=ASC returns up to 5,000 bars as values: [{datetime, open, high, low, close, volume}]. Intervals: 1min, 5min, 15min, 30min, 45min, 1h, 2h, 4h, 1day, 1week, 1month. Errors come back with status: "error", a code and a message, so check status before reading values.
Forex and crypto use the same BASE/QUOTE spelling AlgoGP uses, so EUR/USD and BTC/USD work unchanged. Add exchange= to pick a specific crypto venue or stock listing.
Credits and plans
Most endpoints cost one API credit per symbol; batch requests cost one per symbol in the batch. Paid plans (Grow about $79, Pro about $229 and Ultra about $999 per month) are priced by credits per minute and add more exchanges, fundamentals and WebSocket streaming. Twelve Data publishes a 99.95% SLA on applicable paid tiers and roughly 170 ms average WebSocket latency.
Use Twelve Data in AlgoGP
Open a project, go to the APIs & keys tab and, under Platforms, pick Twelve Data as the market data source (market_data.py). The choice is saved to config.json as a new strategy version:
{
"platforms": {
"data": "twelve-data",
"broker": "alpaca"
}
}backtest.py and live.py connect to when you run the exported code.| Key | What it is |
|---|---|
TWELVE_DATA_API_KEY | Twelve Data API key from twelvedata.com/account/api-keys. |
.env.New to Twelve Data? Follow the step-by-step Twelve Data API key guide.
Twelve Data API: frequently asked questions
Is Twelve Data free?
The Basic plan is free with 800 requests per day and 8 per minute, no card required.
Does Twelve Data have 4-hour bars?
Yes, interval=4h is native, along with 2h and 45min.
Which markets are on the free plan?
US stocks, forex and crypto are included; some international exchanges and datasets require a paid plan.
Turn Twelve Data data into a tested strategy
Backtest an idea in the browser, then export Python whose live loop reads candles straight from Twelve Data with your own key.
- Generated Twelve Data candle fetcher, closed bars only
- An AI copilot that writes and revises the rules
- Pair it with Alpaca, Binance, OANDA or another broker
Free plan, no card required. Twelve Data is included with Pro.
Twelve Data alternatives
- Massive (Polygon.io) API Built into AlgoGP (data)Institutional-grade US stock, options, forex and crypto aggregates; Polygon.io renamed to Massive in 2025.
- EODHD API Built into AlgoGP (data)EOD Historical Data: global end-of-day and intraday prices for 150k+ tickers, fundamentals, FX and crypto at low cost.
- Alpha Vantage API Built into AlgoGP (data)Free API key for stock, forex and crypto time series plus technical indicators and fundamentals.
- Finnhub API Built into AlgoGP (data)Stock, FX and crypto prices plus fundamentals, estimates, news and alternative data behind one API key.
Comparisons
Independent guide. AlgoGP is not affiliated with Twelve Data. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.