Skip to main content
Not every Pegana print is equally trustworthy. A jitoSOL spread computed from a fresh Sanctum read + a deep Jupiter route at 1pm UTC is high-confidence. The same spread computed from a 25-second-old Sanctum read + a Jupiter route through a single thin pool at 3am UTC is low-confidence. The confidence field in every API response captures that quality on a 0.0 – 1.0 scale. Consumers should set a floor (0.9 is the default we recommend) and ignore prints below it for any automation that pulls a real-money trigger.

What feeds confidence

confidence = w_depth × depth_score
           + w_freshness × freshness_score
           + w_decode × decode_score
with w_depth = 0.5, w_freshness = 0.3, w_decode = 0.2.

Depth score

How much liquidity was available at the probe size. Computed from Jupiter’s quote metadata — slippage at probe size relative to a configured “healthy” depth band.
  • > $1M available at probe size → depth_score = 1.0
  • < $50kdepth_score = 0.0
  • Linear interpolation between

Freshness score

Time since the most recent source update (Sanctum, Pyth, etc.).
  • < 5s since last update → freshness_score = 1.0
  • > 30sfreshness_score = 0.0 (and the asset flips to UNKNOWN)
  • Linear interpolation

Decode score

Did the on-chain decoder produce a result, and did the cached IDL match the on-chain canonical IDL on the last verification?
  • IDL match + successful decode → decode_score = 1.0
  • IDL drift detected or decoder threw → decode_score = 0.0 (asset → UNKNOWN)

When confidence drops

A drop in confidence does not change the state on its own. PEGGED with confidence 0.6 is still PEGGED — the published state is what the FSM saw. But you should treat it as “PEGGED, but I wouldn’t bet money on it without re-fetching.” Three patterns trigger sustained low confidence:
  1. Thin venues at low volume hours. Common for emerging yield-bearing assets and exotic LSTs during US-night / Asia-morning hours. Confidence floats around 0.6–0.8.
  2. Source rate limiting. If Pyth or Jupiter hits a quota limit, freshness scores drop. We have backoff with jitter to recover, but during the backoff window confidence will dip.
  3. IDL drift. When the protocol upgrades and our pinned IDL no longer matches, decode_score → 0 and the asset is forced to UNKNOWN. Worst case — we don’t know the truth about the asset’s intrinsic.

How to use it

const state = await fetch(`https://api.pegana.xyz/v1/state/${asset}`).then(r => r.json());

if (state.confidence < 0.9) {
  // Re-fetch in 15s, or skip the decision
  return;
}

if (state.state === "DEPEG" && state.confidence >= 0.95) {
  // Fire the automation
}
In a webhook receiver, you should still verify the Ed25519 signature on the payload, then check confidence before acting. A signed-but-low-confidence webhook is a hint to act conservatively, not an immediate trigger.

Confidence threshold per use case

Use caseMin confidence
Telegram bot display0.0 (we show everything)
Dashboard chart0.5 (we render with a low-confidence indicator)
Webhook to a notifier0.8
Webhook to a liquidation pause0.9
Webhook to a payout0.95 + additional verification (human or multi-sig)
There is no universal answer. Calibrate against your downstream’s blast radius.

What happens at confidence = 0

When confidence drops to zero, the asset flips to UNKNOWN and stays there for at least 60 seconds after the underlying issue resolves. This is the same dwell logic as the FSM exit threshold — we want subscribers to trust an exit from UNKNOWN, not chase a flapping signal. If an asset is UNKNOWN for >15 minutes, treat it as a real problem at the source and go investigate. The status page at pegana.xyz/status shows which sources are healthy.