Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Real-time and historical stock and forex market data via Twelve Data API: quotes, OHLCV time series, and symbol search.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: twelvedata3version: 2.0.24description: "Stocks, forex, and commodities price data — real-time quotes, historical time series, and reference data"5delivery: script6metadata:7starchild:8emoji: "📊"9skillKey: twelvedata10requires:11env:12- TWELVEDATA_API_KEY1314user-invocable: false15disable-model-invocation: false16---1718# Twelve Data1920Stocks, forex, and commodities price data. **Traditional markets only — not for crypto.**2122## Script Usage2324This skill ships a single `exports.py` with all functions. Call it from a25`bash` block:2627```bash28python3 - <<'EOF'29import sys, json30sys.path.insert(0, "/data/workspace/skills/twelvedata")31from exports import twelvedata_price, twelvedata_quote, twelvedata_time_series3233# Single quote34print(twelvedata_quote(symbol="AAPL"))3536# Time series (last 30 daily candles)37series = twelvedata_time_series(symbol="AAPL", interval="1day", outputsize=30)38print(json.dumps(series.get("values", [])[:3], indent=2))39EOF40```4142Available functions in `exports.py`: `twelvedata_price`, `twelvedata_quote`,43`twelvedata_time_series`, `twelvedata_eod`, `twelvedata_quote_batch`,44`twelvedata_price_batch`, `twelvedata_search`, `twelvedata_stocks`,45`twelvedata_forex_pairs`, `twelvedata_exchanges`. Read `exports.py`46directly when you need exact signatures.474849## Function Reference (signatures)5051All functions are in `exports.py`. Symbols use TwelveData format (e.g. `AAPL`,52`EUR/USD`, `XAU/USD`). Use `prepost=True` for pre/post-market data on53US stocks.5455| Function | Description |56|---|---|57| `twelvedata_price(symbol, prepost=False)` | Current price for one symbol. |58| `twelvedata_price_batch(symbols, prepost=False)` | Prices for multiple symbols (`symbols` = comma-separated string). |59| `twelvedata_quote(symbol, prepost=False)` | Detailed quote: price, volume, 52w high/low, change %. |60| `twelvedata_quote_batch(symbols, prepost=False)` | Detailed quotes for multiple symbols. |61| `twelvedata_time_series(symbol, interval='1day', outputsize=30, start_date=None, end_date=None, prepost=False)` | OHLCV bars. `interval` = `1min`/`5min`/`15min`/`30min`/`1h`/`2h`/`4h`/`1day`/`1week`/`1month`. |62| `twelvedata_eod(symbol, date=None, prepost=False)` | End-of-day price for a date (default: latest). |63| `twelvedata_search(query)` | Search symbols by name or ticker. |64| `twelvedata_stocks(exchange=None, country=None)` | List supported stocks (filterable). |65| `twelvedata_forex_pairs()` | List all supported forex pairs. |66| `twelvedata_exchanges()` | List supported exchanges. |6768## Keyword → Tool Lookup6970| User asks about | Tool | NOT this |71|----------------|------|----------|72| "AAPL 股价", "current price" (single) | `twelvedata_quote` | Not `twelvedata_price` (less detail) |73| "just the price number" | `twelvedata_price` | — |74| "多只股票对比" (2+ symbols) | `twelvedata_quote_batch` | Not multiple `twelvedata_quote` calls |75| "K线", "历史数据", "time series" | `twelvedata_time_series` | — |76| "收盘价" | `twelvedata_eod` | — |77| "找股票代码" | `twelvedata_search` | — |78| "NASDAQ 有哪些股票" | `twelvedata_stocks` | — |79| "汇率", "EUR/USD" | `twelvedata_quote(symbol="EUR/USD")` | — |80| "外汇对列表" | `twelvedata_forex_pairs` | — |81| "金价", "oil price" | `twelvedata_quote(symbol="XAU/USD")` | Not CoinGecko |82| "BTC price", any crypto | **CoinGecko** `coin_price` | ❌ Never twelvedata for crypto |8384## TwelveData vs CoinGecko — Boundary8586| Asset class | Use | Why |87|-------------|-----|-----|88| Stocks (AAPL, TSLA) | **TwelveData** | CoinGecko has no stocks |89| Forex (EUR/USD) | **TwelveData** | CoinGecko has no forex |90| Commodities (gold, oil) | **TwelveData** | CoinGecko has no commodities |91| Crypto (BTC, ETH, SOL) | **CoinGecko** | TwelveData crypto data is limited/unreliable |9293## MISTAKES — Read Before Calling9495### ❌ MISTAKE 1: Using TwelveData for crypto96```97User: "BTC 价格"98❌ WRONG: twelvedata_quote(symbol="BTC/USD")99✅ RIGHT: coin_price(ids="bitcoin") ← CoinGecko100```101102### ❌ MISTAKE 2: Calling quote individually for multiple stocks103```104User: "AAPL MSFT GOOGL 现在什么价"105❌ WRONG: twelvedata_quote("AAPL"), twelvedata_quote("MSFT"), twelvedata_quote("GOOGL") ← 3 calls106✅ RIGHT: twelvedata_quote_batch(symbols=["AAPL", "MSFT", "GOOGL"]) ← 1 call, up to 120 symbols107```108109### ❌ MISTAKE 3: Forex without slash110```111❌ WRONG: twelvedata_quote(symbol="EURUSD")112✅ RIGHT: twelvedata_quote(symbol="EUR/USD") ← always slash format113```114Also: `USD/CNH` not `USDCNH`, `GBP/JPY` not `GBPJPY`.115116### ❌ MISTAKE 4: Expecting bid/ask from quote117```118❌ WRONG: "EUR/USD bid: 1.0850, ask: 1.0852" ← quote only returns close119✅ RIGHT: "EUR/USD current price: 1.0851 (close/last price — bid/ask spread not available)"120```121122### ❌ MISTAKE 5: Wrong interval format123```124❌ WRONG: twelvedata_time_series(interval="1D") ← uppercase125✅ RIGHT: twelvedata_time_series(interval="1day")126```127Valid: `1min`, `5min`, `15min`, `30min`, `1h`, `2h`, `4h`, `8h`, `1day`, `1week`, `1month`128129### ❌ MISTAKE 6: Using full output when compact suffices130```131User: "AAPL 最近走势"132❌ WRONG: twelvedata_time_series(symbol="AAPL", interval="1day", outputsize="full") ← 5000 candles133✅ RIGHT: twelvedata_time_series(symbol="AAPL", interval="1day", outputsize="compact") ← 30 candles134```135Use `full` only when user explicitly needs deep history.136137## Symbol Reference138139### Commodities (verified)140141| Asset | Symbol |142|-------|--------|143| Gold | `XAU/USD` |144| Silver | `XAG/USD` |145| Platinum | `XPT/USD` |146| Palladium | `XPD/USD` |147| Crude Oil (WTI) | `WTI/USD` |148| Natural Gas | `NG/USD` |149150### Popular Forex Pairs151152| Pair | Symbol |153|------|--------|154| Euro / USD | `EUR/USD` |155| GBP / USD | `GBP/USD` |156| USD / JPY | `USD/JPY` |157| USD / CNH | `USD/CNH` |158159Use `twelvedata_search` to discover others.160161## Pre/Post-Market Data162163```164twelvedata_quote(symbol="AAPL", prepost=true)165twelvedata_time_series(symbol="AAPL", interval="1min", prepost=true)166```167Returns `premarket_change`, `premarket_change_percent`, `postmarket_change`, `postmarket_change_percent` when available.168169## Output Sizes170171- `compact` — Last 30 data points (default, faster). Use for "最近走势".172- `full` — Up to 5000 data points. Use for deep analysis / charting.173174## Proxy-Safe Usage1751761. **Agent tool calls**: Always prefer `twelvedata_*` tools (this skill).1772. **Platform code** (`skills/`, `tools/`): use `core.http_client`.1783. **Workspace scripts** (`bash`): Do NOT call TwelveData directly. Use skill tools.179180## Compound Queries181182### Stock Comparison183```1841. twelvedata_quote_batch(symbols=["AAPL", "MSFT", "GOOGL", "TSLA"])1852. twelvedata_time_series(symbol="AAPL", interval="1day", outputsize="compact") ← only for the one user cares most about186```187188### Macro Dashboard (stocks + forex + commodities)189```1901. twelvedata_quote_batch(symbols=["SPY", "QQQ"]) → US indices1912. twelvedata_quote_batch(symbols=["EUR/USD", "USD/JPY"]) → Forex1923. twelvedata_quote(symbol="XAU/USD") → Gold193```194