Twelve Data
Twelve Data — Stocks, FX and crypto bars from one tidy API — the cleanest schema among the free tiers
When you want one API and one schema for prices across asset classes — daily or intraday bars for a US or global stock, an FX pair, a crypto pair — and a free tier with clear limits you can plan around.
Reach for it when…
When you want one API and one schema for prices across asset classes — daily or intraday bars for a US or global stock, an FX pair, a crypto pair — and a free tier with clear limits you can plan around.
Not for: Deep history (many symbols start in the 2000s), fundamentals in depth (a light set on paid tiers), anything you will redistribute without a plan.
Units, revisions, traps
Units. Prices in the instrument's currency; datetime in the exchange's timezone unless you set timezone=UTC. Values are strings in the JSON — cast them.
Revisions. Adjusted and unadjusted prices are both offered (adjust=all); corporate actions change history.
- Credits, not requests: one time_series call is one credit, but some endpoints cost more.
- The demo key works only for a handful of symbols; a 'symbol not found' with demo is not a real error.
- Outputsize defaults to 30 bars; set it explicitly.
Classic mistake: Comparing an unadjusted close before a split with an adjusted one after.
Three recipes
- Recipe 1 · Daily bars for one stock
- Recipe 2 · An FX pair at 1-hour bars
- Recipe 3 · Several symbols in one call
Each recipe: Python · Excel · Sheets, with how to read the result. Python recipes run under pandas; recipe 1 is re-run by the weekly check where the source allows it.
How to use it in your own work
Copy the snippet, change the series id, read the result the way the footer says. Replace YOUR_…_KEY with your own key where one is needed.
Recipe 1Daily bars for one stock
import requests, pandas as pd
KEY = "demo" # works for AAPL; use your own key for anything else
u = f"https://api.twelvedata.com/time_series?symbol=AAPL&interval=1day&outputsize=100&apikey={KEY}"
j = requests.get(u, timeout=30).json()
df = pd.DataFrame(j["values"]).set_index("datetime").astype(float).sort_index()
print(df.tail())- Data → From Web → the same URL with &format=CSV → Load.
=IMPORTDATA("https://api.twelvedata.com/time_series?symbol=AAPL&interval=1day&outputsize=100&apikey=demo&format=CSV")Recipe 2An FX pair at 1-hour bars
import requests, pandas as pd
KEY = "YOUR_TWELVEDATA_KEY"
u = f"https://api.twelvedata.com/time_series?symbol=USD/KRW&interval=1h&outputsize=200&timezone=UTC&apikey={KEY}"
j = requests.get(u, timeout=30).json()
df = pd.DataFrame(j["values"]).set_index("datetime").astype(float).sort_index()
print(df.tail())- From Web with &format=CSV.
=IMPORTDATA with &format=CSV.Recipe 3Several symbols in one call
import requests, pandas as pd
KEY = "YOUR_TWELVEDATA_KEY"
u = f"https://api.twelvedata.com/time_series?symbol=AAPL,MSFT,BTC/USD&interval=1day&outputsize=30&apikey={KEY}"
j = requests.get(u, timeout=30).json()
closes = {s: pd.Series({v["datetime"]: float(v["close"]) for v in j[s]["values"]}) for s in j}
print(pd.DataFrame(closes).sort_index().tail())- One query per symbol.
- One IMPORTDATA per symbol.
Series → question map
The ids we use from Twelve Data, each with the question it answers. The catalog's compare view reads the concept tags behind these rows.
| Series | Answers | Region | Concept |
|---|---|---|---|
| time_series · AAPL 1day | Daily OHLC for a stock | United States | ohlc_daily |
| time_series · 1min–1h | Intraday bars | global | intraday |
| time_series · USD/KRW | An FX pair, intraday | Korea | fx_usd |
| time_series · BTC/USD | Bitcoin bars | global | crypto_spot |
Compare with
Same question, different source: EODHD, Polygon.io, Stooq. The compare view lines up coverage, frequency, history and access side by side and lists what the combination makes possible.
Questions readers ask
What does the free tier allow?
800 credits a day and 8 a minute at the time of writing — enough for a dashboard refreshed a few times a day.
Can I use it in a newsletter?
Displaying data publicly needs a paid plan under their terms; a personal notebook does not.
Does it have fundamentals?
A light set (statements, dividends) on paid tiers; for filed numbers use EDGAR.
Educational only — we explain, we never advise · snippet licence: public domain · corrections to [email protected], fixed within a day and logged in the changelog.