Retrieve the latest per-period emission (supply increase) for each tracked coin at a chosen timeframe, plus the coin’s average USD price over that period and the USD value of the emission.
Internally, the service:
- aggregates per-coin daily average price and last daily market cap from MySQL,
- fetches daily supply,
- applies trailing SMA smoothing to supply,
- builds rolling intervals by your requested frequency,
- estimates annualized emission from a dynamic baseline (≤365 days; YoY where possible), smooths it,
- then converts to per-period emission by dividing by periods-per-year.
Endpoint
GET /emissionbytimeframe.php
This endpoint does not enforce subscription tiers.
Query parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
frequency | string | Yes | d | One of d, w, m, y. Controls the reporting period and the divisor for per-period emission. |
supply_window | int | No | 365 | Trailing SMA window (days) applied to the daily supply series. |
emission_window | int | No | 183 | Trailing SMA window applied to the annualized emission series (nulls ignored). |
yoy_min_days | int | No | 30 | Minimum history (days) required to compute the dynamic baseline; otherwise the interval is skipped. |
activation_days | int | No | 30 | For the first N days after first non-zero supply, per-period emission is forced to 0 (stability gate). |
debug | 1/true | No | 0 | When enabled, includes _debug diagnostics while still writing the normal payload. |
Periods per year: d → 365, w → 52, m → 12, y → 1.
Response
Top level
| Field | Type | Description |
|---|---|---|
Timestamp | string (ISO 8601, UTC) | Response generation time. |
Frequency | string | Effective timeframe: d, w, m, or y. |
supply_window | integer | Supply smoothing window used. |
emission_window | integer | Annual emission smoothing window used. |
yoy_min_days | integer | Minimum baseline days used. |
activation_days | integer | Activation gate used. |
Tier | string | Echoed subscription tier (not enforced). |
data | array | One latest record per coin for the chosen timeframe. |
Each data[] item
| Field | Type | Description |
|---|---|---|
ID | string | Coin id (exact table id from proxy list). |
Coin | string | Coin display name. |
Symbol | string | Coin symbol. |
SmoothedAnnualEmissionSupply | string (decimal) | Annualized emission (supply units/year) after smoothing. |
PerPeriodEmissionSupply | string (decimal) | Emission scaled to the selected period = annual / periods_per_year. |
AvgPriceUSD | string (2 dp) | Average USD price over the latest interval. |
EmissionUSD | string (2 dp) | PerPeriodEmissionSupply × AvgPriceUSD. |
From | YYYY-MM-DD | Start date of the latest interval. |
To | YYYY-MM-DD | End date of the latest interval. |
Notes
- Numeric values are strings: supplies to 8 dp; prices and USD values to 2 dp.
- Dates are UTC and use
YYYY-MM-DD.
Calculation details (per coin)
- Daily aggregation: load daily series (price, market cap, supply).
- Trim near-zero head (launch artifacts) relative to the latest supply.
- Supply smoothing: trailing SMA of length
supply_window. - Build intervals: walk backward from the latest day using the chosen frequency.
- Dynamic annualization: for each interval end
t, setL = min(365, t − firstNonZeroDay)in days. IfL ≥ yoy_min_days, computeannual_raw = (S(t) − S(t−L)) × 365 / L. - Annual smoothing: trailing SMA of length
emission_window(nulls ignored). - Per-period:
per_period = annual_smoothed / periods_per_year. - Activation gate: if
To ≤ firstNonZeroDay + activation_daysand an annual value exists, setper_period = 0. - Pricing: average price over the same latest interval;
EmissionUSD = per_period × AvgPriceUSD.
Example requests
Daily (default smoothing)
GET /emissionbytimeframe.php?frequency=d
Weekly, gentler supply smoothing and longer emission smoothing
GET /emissionbytimeframe.php?frequency=w&supply_window=180&emission_window=270
Monthly with stricter baselining and longer activation gate
GET /emissionbytimeframe.php?frequency=m&yoy_min_days=60&activation_days=45
Example response (truncated)
{
"Timestamp": "2025-07-17T23:19:17Z",
"Frequency": "d",
"supply_window": 365,
"emission_window": 183,
"yoy_min_days": 30,
"activation_days": 30,
"Tier": "basic",
"data": [
{
"ID": "bitcoin",
"Coin": "Bitcoin",
"Symbol": "BTC",
"SmoothedAnnualEmissionSupply": "398100.00000000",
"PerPeriodEmissionSupply": "1090.68493151",
"AvgPriceUSD": "63700.00",
"EmissionUSD": "69482956.78",
"From": "2025-06-20",
"To": "2025-06-21"
}
]
}
(Values are illustrative.)
Caching
- File cache per frequency and parameter set for2 hours.
- When a cached response is served, header
X-Cache-Hit: trueis included.
Errors
- 400 — Invalid frequency.
- 403 — Access denied (Origin/Referer/header checks failed).
- 500 — Database connection error.
- 502 — Failed to fetch coin list from
proxy.phpor list malformed.
Practical tips
- The endpoint returns only the latest interval per coin for the chosen frequency.
- Increase
supply_window/emission_windowfor smoothing; decrease for responsiveness. - Early zeros often come from the activation gate; adjust
activation_daysif needed.
