API Documentation
REST API for US ETF data — universe, batch prices, market status, and backtesting endpoints.
Official SDKs
Use the official client libraries instead of hand-rolling HTTP calls. Same API key, typed methods for screener, rankings, heatmap, backtest, and portfolio endpoints.
JavaScript / TypeScript
npm · datacaptain@0.1.0
npm install datacaptainimport { DataCaptain } from "datacaptain";
const dc = new DataCaptain({ apiKey: process.env.DATACAPTAIN_API_KEY });
const rankings = await dc.etf.rankings({ category: "return", period: "1y" });Python
PyPI · datacaptain@0.1.0
pip install datacaptainfrom datacaptain import DataCaptain dc = DataCaptain(api_key="YOUR_API_KEY") rankings = dc.etf_screener(return_min=10, period="1y")
Full SDK docs with install + examples →
Packages: npm · PyPI. Source in packages/datacaptain and packages/datacaptain-python.
Authentication
Include your API key in the x-api-key header for all requests.
x-api-key: YOUR_API_KEYETF Endpoints
/api/etf/listlimit=100&offset=0&search=SPYcache: 60sPaginated US ETF universe from database. Returns { data, total, limit, offset }.
/api/etf/:symbolcache: 60sSingle ETF details — symbol, name, latest price, exchange.
/api/etf/heatmap?basket=broad&period=1ycache: 60sETF performance heatmap — colored cells by return % for preset baskets or custom symbol lists.
/api/etf/screener?returnMin=10÷ndYieldMin=2&period=1ycache: 60sFilter ETFs by return and dividend yield. Free plan returns top 10 matches.
/api/etf/rankings?category=return&period=1y&limit=20cache: 60sETF leaderboards — top return, top dividend yield, or lowest volatility. Free plan returns top 10.
/api/stocks/prices?symbols=SPY,QQQ,VOOcache: 60sBatch ETF prices — latest close for up to 50 ETF tickers in one request. Cached 60s.
Market
/api/market/statuscache: 30sUS market session status from NYSE calendar (holidays + early closes). Regular 09:30–16:00 ET.
Backtesting & Portfolio
/api/backtest/buy-and-holdETF buy-and-hold backtest — total return, CAGR, drawdown, dividend yield, risk score, equity curve.
/api/portfolio/rebalanceETF portfolio rebalancer — compare current holdings to target weights and get buy/sell suggestions.
/api/backtest/compareCompare multiple ETFs — e.g. VOO vs SPY vs QQQ. Returns ranked results.
Developer
/api/developer/usageUsage stats — plan, requests today, remaining, daily limit.
WebSocket (Real-Time)
Real-time ETF price streaming (when enabled). Subscribe to ETF symbols for periodic updates.
Subscribe:
{"action":"subscribe","symbols":["SPY","QQQ"]}