Built into AlgoGP (data) Pro
Market dataStocksETFsForexCryptoIndices API key

Twelve Data API guide

Twelve Data covers stocks on dozens of exchanges, forex, crypto, ETFs and indices behind one consistent API, with bars from one minute to one month. Its free Basic plan gives 800 requests a day, which is enough for several daily and hourly strategies.

Last verified

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
apikey query parameter or Authorization: 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"
  }
}
In-app backtests always use AlgoGP’s normalized history so results stay comparable; this choice decides what backtest.py and live.py connect to when you run the exported code.
KeyWhat it is
TWELVE_DATA_API_KEYTwelve Data API key from twelvedata.com/account/api-keys.
Names the generated code reads. Add values under Keys & secrets or in a local .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

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.