Skip to content

Sparse Oracle

For cards with thin trading history, Coda extends the TWAP window and applies statistical techniques to produce a price even when primary-window data is sparse.

Live oracle only

This path runs only on live API calls. Settlement finalization always uses the standard closed-window TWAP.


Trigger

After the standard outlier filter, if the primary window (window_hours, default 24h) has too few included observations, the sparse oracle activates automatically.


Step 1 - extended window

The observation fetch is extended to a 30-day rolling window.

meta.twap_sparse_window_extended: true when this activates.


Step 2 - recency-weighted TWAP

Standard duration weighting is replaced with an exponentially decayed mean biased toward recent observations. Older data contributes progressively less to the final price.

Relevant meta fields:

  • twap_sparse_primary_included_points - how many points were in the original window
  • twap_effective_window_hours - extended window used
  • recency_half_life_hours - decay parameter applied

Step 3 - ridge WLS forecast

If there are no observations in the primary window but sufficient data exists in the 30-day extended window, a linear trend is fit using Weighted Least Squares with ridge regularization. The regularization prevents small-sample extrapolation from producing unreliable forecasts.

The forecast is blended with the recency-weighted mean using proprietary weights, then clamped to the observed min/max range. Falls back to recency-only if the system is ill-conditioned.

Relevant meta fields:

  • twap_stale_history_wls_forecast: true
  • twap_stale_wls_blend
  • twap_stale_wls_y_hat_pre_blend
  • twap_stale_wls_recency_mean_minor

Example meta for a sparse card

json
{
  "twap_sparse_window_extended": true,
  "twap_sparse_primary_included_points": 1,
  "twap_effective_window_hours": 720,
  "twap_stale_history_wls_forecast": true,
  "twap_stale_wls_blend": { "forecast": 0.62, "recency": 0.38 },
  "twap_stale_wls_y_hat_pre_blend": 85000,
  "twap_stale_wls_recency_mean_minor": 79000
}

Fallback chain after sparse oracle

If a price still cannot be computed:

TierSource
1Prior snapshot (same methodology, within 30 days)
2Adjacent grade snapshot (same grader)
3Composite band TWAP
4NM market TWAP as a cross-tier proxy
5Median of any recent observations
61 cent placeholder

meta.oracle_fallback_tier records which tier fired.

Coda - price settlement infrastructure.