twelvedata-api

from adaptationio/skrillz

No description

1 stars0 forksUpdated Jan 16, 2026
npx skills add https://github.com/adaptationio/skrillz --skill twelvedata-api

SKILL.md

Twelve Data API Integration

Comprehensive financial data API providing stocks, forex, crypto, ETFs, indices, and 100+ technical indicators with excellent Python SDK support.

Quick Start

Authentication

# Environment variable (recommended)
export TWELVEDATA_API_KEY="your_api_key"

# Or in .env file
TWELVEDATA_API_KEY=your_api_key

Basic Usage (Python)

import requests
import os

API_KEY = os.getenv("TWELVEDATA_API_KEY")
BASE_URL = "https://api.twelvedata.com"

def get_quote(symbol: str) -> dict:
    """Get real-time quote for a symbol."""
    response = requests.get(
        f"{BASE_URL}/quote",
        params={"symbol": symbol, "apikey": API_KEY}
    )
    return response.json()

# Example
quote = get_quote("AAPL")
print(f"AAPL: ${quote['close']} ({quote['percent_change']}%)")

Using Official SDK

from twelvedata import TDClient

td = TDClient(apikey="your_api_key")

# Get time series
ts = td.time_series(
    symbol="AAPL",
    interval="1day",
    outputsize=30
).as_pandas()

# Get quote
quote = td.quote(symbol="AAPL").as_json()

# Get with technical indicators
ts_with_indicators = td.time_series(
    symbol="AAPL",
    interval="1day",
    outputsize=50
).with_sma(time_period=20).with_rsi().as_pandas()

API Endpoints Reference

Core Data

EndpointDescriptionCredits
/quoteReal-time quote1
/priceCurrent price only1
/eodEnd of day price1
/time_seriesHistorical OHLCV1
/exchange_rateCurrency conversion1

Reference Data

EndpointDescriptionCredits
/symbol_searchSearch symbols1
/instrumentsList all instrumentsFree
/exchangesList exchangesFree
/instrument_typeList typesFree
/earliest_timestampData start dateFree

Fundamental Data

EndpointDescriptionCredits
/income_statementIncome statement100
/balance_sheetBalance sheet100
/cash_flowCash flow100
/earningsEarnings history100
/earnings_calendarUpcoming earnings100
/dividendsDividend history1
/splitsSplit history1
/statisticsKey statistics100
/profileCompany profile100

Technical Indicators (100+)

All indicators cost 1 credit and are included with time_series:

Trend: SMA, EMA, WMA, DEMA, TEMA, KAMA, MAMA, T3, TRIMA, VWMA Momentum: RSI, MACD, Stochastic, Williams %R, ADX, CCI, MFI, ROC, AROON Volatility: Bollinger Bands, ATR, Keltner Channels, Donchian Volume: OBV, AD, ADOSC, VWAP

Rate Limits

TierCalls/MinDailyWebSocket
Free8800Trial only
Grow ($29)55-377Unlimited
Pro ($99)610-1597Unlimited
Enterprise ($329)2584+Unlimited

Credit System:

  • Standard endpoints: 1 credit per symbol
  • Fundamental data: 100 credits per symbol
  • Batch requests: Same cost as individual

Common Tasks

Task: Get Time Series with Pandas

from twelvedata import TDClient
import pandas as pd

td = TDClient(apikey=API_KEY)

def get_historical_data(symbol: str, days: int = 100) -> pd.DataFrame:
    """Get historical OHLCV data as DataFrame."""
    ts = td.time_series(
        symbol=symbol,
        interval="1day",
        outputsize=days
    )
    return ts.as_pandas()

# Example
df = get_historical_data("AAPL", 100)
print(df.head())

Task: Technical Analysis with Multiple Indicators

def get_technical_analysis(symbol: str) -> pd.DataFrame:
    """Get price data with technical indicators."""
    ts = td.time_series(
        symbol=symbol,
        interval="1day",
        outputsize=100
    )

    # Chain indicators
    df = (ts
        .with_sma(time_period=20)
        .with_sma(time_period=50)
        .with_rsi(time_period=14)
        .with_macd()
        .with_bbands()
        .as_pandas()
    )

    return df

# Example
analysis = get_technical_analysis("AAPL")

Task: Get Multiple Symbols (Batch)

def get_batch_quotes(symbols: list) -> dict:
    """Get quotes for multiple symbols efficiently."""
    symbol_str = ",".join(symbols)

    response = requests.get(
        f"{BASE_URL}/quote",
        params={
            "symbol": symbol_str,
            "apikey": API_KEY
        }
    )
    return response.json()

# Example: Up to 120 symbols per request
quotes = get_batch_quotes(["AAPL", "MSFT", "GOOGL", "AMZN"])

Task: Get Fundamental Data

def get_fundamentals(symbol: str) -> dict:
    """Get comprehensive fundamental data."""
    # Note: Each call costs 100 credits

    profile = requests.get(
        f"{BASE_URL}/profile",
        params={"symbol": symbol, "apikey": API_KEY}
    ).json()

    stats = requests.get(
        f"{BASE_URL}/statistics",
        p

...
Read full content

Repository Stats

Stars1
Forks0