← Back to Docs

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).

SourceAPIPillar fedFrequency
Market Sentiment (Fear & Greed)CoinglassPrice & StructureDaily
Bitcoin Spot ETF FlowsCoinglassLiquidityDaily
Stablecoin SupplyDefiLlama + CoinGeckoLiquidityDaily
Exchange NetflowsCoinglass on-chainLiquidityEvery 2 hours
Derivatives (Funding, OI, Liquidations)CoinglassDerivatives + VolatilityEvery 4 hours
Macro Indicators (DXY, US10Y, SPX, VIX)FMP + FREDMacro Context overlayDaily
Required env vars: COINGLASS_API_KEY, FMP_API_KEY, FRED_API_KEY. DefiLlama and CoinGecko are free with no key required.

1. Market Sentiment: Fear & Greed Index

Source

Coinglass API : cg.indicators.fearGreed(). Requires COINGLASS_API_KEY.

Data collected
FieldDescriptionRange
fear_greed_valueComposite sentiment index (latest entry from data_list)0 (Extreme Fear) to 100 (Extreme Greed)
fear_greed_classificationText label derived from the valuee.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).

Update schedule

Every 2 hours via /api/sync/daily.

2. Bitcoin Spot ETF Flows

Source

Coinglass ETF API: cg.etf.btcFlowHistory() for daily flows, cg.etf.btcAum() for AUM history. Aggregated across all major ETFs. Requires COINGLASS_API_KEY.

Data collected
FieldDescriptionUnit
dateTrading date (timestamps are in milliseconds from API)YYYY-MM-DD
total_netTotal net flow across all ETFs for the dayMillions USD
aum_usdTotal 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).

Update schedule

Every 2 hours via /api/sync/daily. ETF data reflects the previous trading day's close.

3. Stablecoin Supply

Sources
  • 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.
Data collected
FieldDescriptionUnit
market_cap_billionsTotal stablecoin market cap (all major coins)Billions USD
supply_change_percent7-day % change in total supplyPercentage
dominance_percentStablecoin mcap / total crypto mcap × 100Percentage

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).

Update schedule

Every 2 hours via /api/sync/daily.

4. Exchange Netflows

Source

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.

Data collected
FieldDescriptionUnit
exchange_netflowNet 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).

Update schedule

Every 2 hours via /api/sync/exchange-flows.

5. Derivatives: Funding Rate, Open Interest & Liquidations

Source

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 rate
cg.futures.oiExchangeList() : aggregate OI across all exchanges (first entry: “All”)
cg.futures.liquidationAggregatedHistory() : 7-day daily breakdown from Binance, OKX, Bybit
Data collected
FieldDescriptionUnit
funding_rate_percentCurrent 8h perpetual funding rate. API value × 100 is stored (0.01 from API = 0.01% stored)% per 8h
open_interest_usdTotal notional open interest across all exchangesUSD
oi_change_24h_pct24-hour % change in OI (computed from stored history, not fetched directly)Percentage
liquidations_24hTotal liquidations in last 24 hours (Binance + OKX + Bybit)Millions USD
avg_liquidations_7d7-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%).

Update schedule

Every 4 hours via /api/sync/derivatives.

6. Macro Indicators

Sources

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).

Data collected
FieldDescriptionSource
dxyUS Dollar Index (synthesized from forex rates)FMP + FRED (computed)
us10y10-year Treasury yield. Forward-filled on non-trading days.FRED DGS10
spxS&P 500 daily closeFMP ^GSPC
vixCBOE Volatility Index. Forward-filled on non-trading days.FMP ^VIX
DXY synthesis formula (ICE)
50.14348112 × EURUSD^−0.576 × USDJPY^0.136
              × GBPUSD^−0.119 × USDCAD^0.091
              × USDSEK^0.042 × USDCHF^0.036

EUR/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.

Update schedule

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

ScheduleEndpointData synced
Every 2 hours/api/sync/dailyFear & Greed (Coinglass), ETF flows (Coinglass), stablecoins (DefiLlama + CoinGecko), macro (FMP + FRED)
Every 2 hours/api/sync/exchange-flowsExchange netflows (Coinglass on-chain)
Every 4 hours/api/sync/derivativesFunding rate, OI, liquidations (Coinglass)