Data Sources
Where all data comes from, how it's collected, and why each source matters.
Overview
Six independent data feeds supply the BTC Regime scoring model. All data is stored in PostgreSQL and refreshed on a fixed cron schedule via Vercel. Everything flows through the Coinglass API except stablecoins (DefiLlama + CoinGecko) and macro indicators (FMP + FRED).
| Source | API | Pillar fed | Frequency |
|---|---|---|---|
| Market Sentiment (Fear & Greed) | Coinglass | Price & Structure | Daily |
| Bitcoin Spot ETF Flows | Coinglass | Liquidity | Daily |
| Stablecoin Supply | DefiLlama + CoinGecko | Liquidity | Daily |
| Exchange Netflows | Coinglass on-chain | Liquidity | Every 2 hours |
| Derivatives (Funding, OI, Liquidations) | Coinglass | Derivatives + Volatility | Every 4 hours |
| Macro Indicators (DXY, US10Y, SPX, VIX) | FMP + FRED | Macro Context overlay | Daily |
COINGLASS_API_KEY, FMP_API_KEY, FRED_API_KEY. DefiLlama and CoinGecko are free with no key required.1. Market Sentiment: Fear & Greed Index
Coinglass API : cg.indicators.fearGreed(). Requires COINGLASS_API_KEY.
| Field | Description | Range |
|---|---|---|
| fear_greed_value | Composite sentiment index (latest entry from data_list) | 0 (Extreme Fear) to 100 (Extreme Greed) |
| fear_greed_classification | Text label derived from the value | e.g. “Fear”, “Greed” |
Why it matters: This is the sole input for the Price & Structure pillar (30% of the final score). Moderate greed (61–75) signals healthy bull momentum and scores highest (+5). Extreme greed (91+) is treated as a contrarian warning (−2). Extreme fear (0–10) is bearish (−6).
Every 2 hours via /api/sync/daily.
2. Bitcoin Spot ETF Flows
Coinglass ETF API: cg.etf.btcFlowHistory() for daily flows, cg.etf.btcAum() for AUM history. Aggregated across all major ETFs. Requires COINGLASS_API_KEY.
| Field | Description | Unit |
|---|---|---|
| date | Trading date (timestamps are in milliseconds from API) | YYYY-MM-DD |
| total_net | Total net flow across all ETFs for the day | Millions USD |
| aum_usd | Total AUM across all ETFs (from btcAum or btcList fallback) | USD |
How it's used: The model sums the last 3 trading days of total_net (absolute USD millions) as the etf3dSum input. Thresholds are fixed dollar amounts: >$500M strongly bullish (+6), <−$500M strongly bearish (−6). Feeds Component B of the Liquidity pillar (55% weight within pillar).
Every 2 hours via /api/sync/daily. ETF data reflects the previous trading day's close.
3. Stablecoin Supply
- Primary (mcap history): DefiLlama :
fetchStablecoinMcapHistory(). Free, no key required. - Secondary (total market cap for dominance): CoinGecko :
/api/v3/global. Free, no key required. 2s rate limit enforced.
| Field | Description | Unit |
|---|---|---|
| market_cap_billions | Total stablecoin market cap (all major coins) | Billions USD |
| supply_change_percent | 7-day % change in total supply | Percentage |
| dominance_percent | Stablecoin mcap / total crypto mcap × 100 | Percentage |
Why it matters: Stablecoin supply is crypto's “dry powder.” Rising supply means new capital is entering the ecosystem. Contraction signals capital exiting. The supply_change_percent (7-day change) feeds Component A of the Liquidity pillar (25% weight within pillar).
Every 2 hours via /api/sync/daily.
4. Exchange Netflows
Coinglass on-chain API: client.onchain.balanceChart() for historical balance, client.onchain.balanceList() for per-exchange breakdown. Requires COINGLASS_API_KEY. Results cached for 3 hours (1.5× the sync interval) to survive one failed sync.
| Field | Description | Unit |
|---|---|---|
| exchange_netflow | Net BTC value on exchanges (positive = inflow/distribution, negative = outflow/accumulation) | Millions USD |
Why it matters: When large holders move BTC off exchanges they are accumulating (bullish). High inflows signal holders preparing to sell (bearish). Feeds Component C of the Liquidity pillar (20% weight within pillar).
Every 2 hours via /api/sync/exchange-flows.
5. Derivatives: Funding Rate, Open Interest & Liquidations
Coinglass Hobbyist Plan : all three feeds come from Coinglass, which aggregates data from Binance, OKX, Bybit, and other exchanges. Direct exchange API access is not used. Requires COINGLASS_API_KEY.
cg.futures.fundingRateExchangeList() : Binance BTCUSDT perpetual funding ratecg.futures.oiExchangeList() : aggregate OI across all exchanges (first entry: “All”)cg.futures.liquidationAggregatedHistory() : 7-day daily breakdown from Binance, OKX, Bybit| Field | Description | Unit |
|---|---|---|
| funding_rate_percent | Current 8h perpetual funding rate. API value × 100 is stored (0.01 from API = 0.01% stored) | % per 8h |
| open_interest_usd | Total notional open interest across all exchanges | USD |
| oi_change_24h_pct | 24-hour % change in OI (computed from stored history, not fetched directly) | Percentage |
| liquidations_24h | Total liquidations in last 24 hours (Binance + OKX + Bybit) | Millions USD |
| avg_liquidations_7d | 7-day average daily liquidations (from 7-day history) | Millions USD |
Hobbyist plan limitation: The Top Trader Long/Short Ratio endpoint is locked on the Hobbyist plan. This component was planned but excluded. The Derivatives pillar currently uses three components: Funding Rate (40%), OI Change (30%), and Liquidation Cascade Ratio (30%). Historical z-scores are also unavailable via API and are built from accumulated database history instead.
Why it matters: Funding rate is contrarian: high positive funding means longs are overpaying, signaling overcrowded positioning and reversal risk. OI and liquidation data reveal market stress. These feeds drive both the Derivatives pillar (25%) and the Volatility pillar (15%).
Every 4 hours via /api/sync/derivatives.
6. Macro Indicators
SPX, VIX, forex pairs: Financial Modeling Prep (FMP) : getHistoricalPrices(). Requires FMP_API_KEY. Free tier: 250 req/day.
US 10-Year yield: FRED (Federal Reserve) : series DGS10. Requires FRED_API_KEY. Free, 120 req/min.
DXY: Synthesized from 5 FMP forex pairs + 1 FRED series using the ICE DXY formula (see below).
| Field | Description | Source |
|---|---|---|
| dxy | US Dollar Index (synthesized from forex rates) | FMP + FRED (computed) |
| us10y | 10-year Treasury yield. Forward-filled on non-trading days. | FRED DGS10 |
| spx | S&P 500 daily close | FMP ^GSPC |
| vix | CBOE Volatility Index. Forward-filled on non-trading days. | FMP ^VIX |
50.14348112 × EURUSD^−0.576 × USDJPY^0.136
× GBPUSD^−0.119 × USDCAD^0.091
× USDSEK^0.042 × USDCHF^0.036EUR/GBP fetched from FMP. SEK via FRED DEXSDUS. JPY, CAD, CHF from FMP forex endpoints. 400 calendar days of history fetched to support the 200-day moving average.
Important: Macro data feeds the Macro Context overlay only, not the BTC regime score. It adjusts position sizing (100% / 75% / 50%) but does not change regime direction. See Macro Context for details.
Via /api/sync/daily (every 2 hours). Macro data from FMP and FRED updates after US market close; earlier runs will re-fetch the same values until new data is published.
Automated Sync Schedule
| Schedule | Endpoint | Data synced |
|---|---|---|
| Every 2 hours | /api/sync/daily | Fear & Greed (Coinglass), ETF flows (Coinglass), stablecoins (DefiLlama + CoinGecko), macro (FMP + FRED) |
| Every 2 hours | /api/sync/exchange-flows | Exchange netflows (Coinglass on-chain) |
| Every 4 hours | /api/sync/derivatives | Funding rate, OI, liquidations (Coinglass) |