Registry / analytics / twelvedata

twelvedata

JSON →
library1.4.0pypypi✓ verified 84d ago

A Python client for the Twelve Data API, providing access to real-time and historical stock, forex, and cryptocurrency data. Version 1.4.0 supports Python 2.7+ and 3.5+. Released infrequently; last update in 2022.

pip install twelvedata
INSTALL
IMPORT
SIG · TWELVEDATA
T
twelvedata
analyticspythonv1.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TDClient
from twelvedata import TDClient
TDClient is the main class for API interaction.
TwelveData
from twelvedata import TwelveData
There is no 'TwelveData' class; correct class name is TDClient.

Initialize TDClient with API key, fetch time series data, and convert to pandas DataFrame.

from twelvedata import TDClient td = TDClient(apikey=os.environ.get('TWELVEDATA_API_KEY', '')) ts = td.time_series(symbol='AAPL', interval='1min', outputsize=1) df = ts.as_pandas() print(df.head())
Debug
Known issues
gotchaThe TDClient constructor requires 'apikey' parameter. Do not use 'api_key' or 'API_KEY'.
affects: all
deprecatedThe '.as_json()' method is deprecated in favor of '.as_pandas()' or '.as_dict()'.
fix
Use .as_pandas() or .as_dict() instead.
affects: >=1.0.0
Errors
Common errors & fixes
twelvedata.exceptions.TwelveDataApiError: {'code': 401, 'message': 'Invalid API key'}
Missing or incorrect API key.
fix
Set TWELVEDATA_API_KEY environment variable or pass correct apikey to TDClient.
AttributeError: module 'twelvedata' has no attribute 'TwelveData'
Wrong import; the class is named TDClient.
fix
Use 'from twelvedata import TDClient'.
Upgrade
Version history
1.4.0latest on PyPI · released Apr 27, 2026
Audit
Dependencies
requestsrequiredUsed for HTTP requests to the Twelve Data API.
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
twelvedata — pip install twelvedata · libregistry