📡 API Documentation

Access Bitcoin chart data programmatically

⚠️ For Developers

Important: When adding a new chart to the platform, you MUST update this API documentation page. Add the new endpoint below following the same format as existing endpoints. Include:

  • Endpoint URL and HTTP method
  • Example request with curl command
  • Interactive "Try It!" button
  • Response fields table
  • Chart-specific details and data sources

🚀 Getting Started

The Bitcoin Charts API provides real-time and historical data for various Bitcoin indicators and models. All endpoints return JSON responses and support customizable parameters for timespan, interval, and data limits.

Base URL

https://charts.bitcoin.com/api/v1

Authentication

Currently, no authentication is required. All endpoints are publicly accessible.

Rate Limiting

No rate limits are currently enforced, but please use the API responsibly.

📋 Common Parameters

These parameters are available across all chart endpoints:

Parameter Type Default Description
interval string daily Data interval: hourly, daily, weekly
timespan string all Time range: 30d, 1y, 2y, 5y, all
limit number 5000 Maximum number of data points to return

🥧 Pi Cycle Top Indicator

111-day MA vs 350-day MA × 2 - Historical market top predictor

GET /api/v1/charts/pi-cycle-top

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/pi-cycle-top?interval=daily×pan=1y&limit=365"

Response Fields

Field Description
data.price Array of Bitcoin price data points
data.ma111 Array of 111-day moving average values
data.ma350x2 Array of 350-day MA × 2 values
data.crosses Array of historical cross events (top signals)

🌈 Rainbow Chart

Color-banded logarithmic price zones showing market phases

GET /api/v1/charts/rainbow

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/rainbow?interval=daily×pan=2y"

Response Fields

Field Description
data.price Bitcoin price data with timestamps
data.bands Color band thresholds and current zone
currentZone Current market phase (e.g., "Fire Sale", "HODL", "FOMO")

📈 Stock-to-Flow Model

PlanB's scarcity-based valuation model

GET /api/v1/charts/stock-to-flow

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/stock-to-flow?interval=daily×pan=all"

Response Fields

Field Description
data.price Actual Bitcoin price data
data.s2fModel Stock-to-Flow model predicted values
data.ratio Price to model ratio

Golden Ratio Multiplier

Fibonacci-based price levels using the 350-day moving average

GET /api/v1/charts/golden-ratio

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/golden-ratio?interval=daily×pan=5y"

Response Fields

Field Description
data.price Bitcoin price data
data.ma350 350-day moving average
data.multipliers Fibonacci multipliers (1.6, 3.3, 5.0, 8.0, etc.)

📊 Mayer Multiple

Price / 200-Day Moving Average ratio

GET /api/v1/charts/mayer-multiple

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/mayer-multiple?interval=daily×pan=1y"

Response Fields

Field Description
data.price Bitcoin price data
data.ma200 200-day moving average
data.multiple Mayer Multiple ratio values

🖨️ Global M2 vs Bitcoin Price

Compare Bitcoin price against US M2 money supply expansion with normalized comparison

GET /api/v1/charts/m2

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/m2?interval=daily×pan=5y"

Response Fields

Field Description
data.combined Combined Bitcoin price and M2 data points (normalized to 100)
data.btcPrice Bitcoin price historical data
data.m2Supply M2 supply monthly data points
current.btcPrice Most recent Bitcoin price
current.m2Billions Most recent M2 supply value in billions USD
normalization.baseDate The date at which both series are indexed to 100

About M2 Data

The M2 data represents US M2 Money Stock from the Federal Reserve Economic Data (FRED). M2 includes cash, checking deposits, savings accounts, and money market securities. Data is sourced from FRED API (series ID: M2SL) and updated monthly. Both Bitcoin price and M2 are normalized to 100 at their earliest shared date for comparative analysis.

🐂 S&P 500 vs Bitcoin Price

Compare S&P 500 Index performance with Bitcoin price, both normalized to 100 for easy comparison

GET /api/v1/charts/sp500

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/sp500?interval=daily×pan=5y"

Response Fields

Field Description
data.combined Combined Bitcoin and S&P 500 data points (both normalized to 100)
data.btcPrice Bitcoin price historical data
data.sp500Values S&P 500 index historical values
current.btcPrice Most recent Bitcoin price
current.sp500Value Most recent S&P 500 index value
current.btcNormalized Bitcoin price normalized to 100 at base date
current.sp500Normalized S&P 500 value normalized to 100 at base date
normalization.baseDate The date at which both series are indexed to 100

About S&P 500 Data

The S&P 500 data represents the S&P 500 stock market index from the Federal Reserve Economic Data (FRED). The S&P 500 tracks the performance of 500 of the largest US companies and is widely considered the best gauge of large-cap U.S. equities. Data is sourced from FRED API (series ID: SP500) and updated daily (every business day). Both Bitcoin price and S&P 500 are normalized to 100 at their earliest shared date for comparative analysis.

📊 Bitcoin vs The Macro Mood Swing

Track Bitcoin price alongside key macroeconomic indicators: Unemployment Rate (UNRATE) and 10-Year Treasury Yield (DGS10)

GET /api/v1/charts/macro-mood

Example Request

curl "https://charts.bitcoin.com/api/v1/charts/macro-mood?interval=daily×pan=5y"

Response Fields

Field Description
data.btcPrice Bitcoin price historical data array (timestamp, price)
data.unrate Unemployment Rate (UNRATE) data array (timestamp, value in %)
data.dgs10 10-Year Treasury Yield (DGS10) data array (timestamp, value in %)
metrics.btcPrice Most recent Bitcoin price (USD)
metrics.btcYoY Bitcoin year-over-year change (%)
metrics.unrate Current unemployment rate (%)
metrics.unrateChange Unemployment rate year-over-year change (percentage points)
metrics.dgs10 Current 10-year treasury yield (%)
metrics.dgs10Change 10-year yield year-over-year change (percentage points)
dataInfo.earliestDate Earliest date with data for all three series
dataInfo.latestDate Most recent date with data

About Macro Mood Swing Data

This chart combines three critical indicators to show how macroeconomic conditions affect Bitcoin:

  • UNRATE (Unemployment Rate) - Monthly data from U.S. Bureau of Labor Statistics. Rising unemployment typically signals economic stress and risk-off behavior.
  • DGS10 (10-Year Treasury Yield) - Daily data from Federal Reserve. Rising yields increase opportunity cost of holding non-yielding assets like Bitcoin.
  • Bitcoin Price - Displayed on logarithmic scale to show exponential growth patterns.

Key Insight: Bitcoin tends to crash when BOTH unemployment spikes AND yields jump, creating a "risk-off" environment. Historical examples include the COVID shock (March 2020: UNRATE hit 14.8%) and Fed tightening cycle (Oct 2022: DGS10 peaked at 4.2%). The data is updated monthly for UNRATE and daily for DGS10, sourced from Federal Reserve Economic Data (FRED).

💰 DCA Calculator

Calculate Dollar Cost Averaging strategies with historical Bitcoin price data. This endpoint accepts POST requests to simulate DCA investment strategies.

POST /api/v1/charts/dca/calculate

Request Parameters

Parameter Type Required Description
amount number Yes USD amount to invest per purchase (e.g., 100)
frequency string Yes Purchase frequency: "daily", "weekly", "bi-weekly", or "monthly"
duration number Yes Duration in years (e.g., 2 for 2 years)
startDate string Yes Start date in YYYY-MM-DD format (e.g., "2022-01-01")

Example Request

curl -X POST "https://charts.bitcoin.com/api/v1/charts/dca/calculate" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 100,
    "frequency": "weekly",
    "duration": 2,
    "startDate": "2022-01-01"
  }'

Response Fields

Field Description
data.purchases Array of purchase events with timestamp, price, BTC purchased, and running totals
data.priceData Historical Bitcoin price data for the specified date range
metrics.totalInvested Total USD invested across all purchases
metrics.totalValue Current value of all BTC purchased (at latest price)
metrics.totalBTC Total Bitcoin accumulated
metrics.percentageChange Percentage gain or loss on investment
metrics.numberOfPurchases Total number of purchases made
metrics.averagePrice Average price per BTC across all purchases

About DCA Strategy

Dollar Cost Averaging (DCA) is an investment strategy where you invest a fixed amount at regular intervals, regardless of the asset price. This calculator simulates historical DCA strategies using actual Bitcoin price data, allowing you to compare different investment approaches. The calculator automatically handles date ranges and calculates accumulation, average cost, and returns based on your specified parameters.

Usage Tips

  • Start dates can go back as far as historical data allows (2010+)
  • Duration + start date cannot exceed current date
  • Daily purchases are calculated based on available daily price data
  • Weekly/Bi-weekly/Monthly purchases use the closest available date
  • Use multiple calculations to compare different strategies

⚠️ Error Responses

All errors follow a consistent format:

{
  "success": false,
  "error": "Error message description",
  "code": "ERROR_CODE"
}

Common Error Codes

Code Status Description
INVALID_PARAMETER 400 Invalid parameter value provided
NOT_FOUND 404 Endpoint or resource not found
SERVER_ERROR 500 Internal server error