QuantOracle

24/7 crypto liquidation alerts for your agent, in one registration

The most common pattern in our API logs: an agent calls /v1/crypto/liquidation-price and /v1/risk/var-parametric on a timer, all day, rebuilding the same monitoring loop out of one-shot math calls. QuantOracle Watch replaces the loop: register a perp position once and we re-evaluate it every 60 seconds — funding-adjusted liquidation distance, funding-rate flips, vol-regime changes — and send an HMAC-signed webhook when something crosses a threshold. You stop polling; we stand watch.

Published June 11, 2026

What it watches

  • Liquidation distance — recomputed every 60s against the live mark price, with your accumulated funding cost folded into effective collateral (funding quietly drags your liquidation price toward the market; most DIY monitors miss this). Two bands: liq_warn and liq_critical, with hysteresis so a position oscillating on a threshold doesn't spam you, and a 6-hour re-alert while you remain in breach.
  • Funding flipsfunding_flip fires when the perp funding rate changes sign: your carry just flipped from earning to paying (or back).
  • Vol regimevol_regime fires when realized volatility shifts regime (checked hourly from fresh daily candles).
  • Expiryexpiry_warning before your monitor lapses, then expired.

Try it in 30 seconds (free, no webhook needed)

The 48-hour trial (one per IP per 30 days) works with zero infrastructure — alerts are recorded server-side and readable by polling, so you don't need a public endpoint just to evaluate:

curl -X POST https://api.quantoracle.dev/v1/watch/trial \
  -H "Content-Type: application/json" \
  -d '{
    "asset": "BTC",
    "direction": "long",
    "entry_price": 62000,
    "position_size": 5000,
    "collateral": 1000,
    "thresholds": {"warn_pct": 15, "critical_pct": 7}
  }'

# → {
#   "monitor_id": "w_7tIxfwKc",
#   "token": "q-HX-...",
#   "tier": "trial",
#   "status": "active",
#   "liquidation_price": 49910,
#   "distance_pct": 19.5,
#   "expires_at": "2026-06-13T02:44:38Z",
#   "check_interval_seconds": 60,
#   "status_url": "https://api.quantoracle.dev/v1/watch/w_7tIxfwKc"
# }

Then poll status with the token — live snapshot plus everything that has fired:

curl "https://api.quantoracle.dev/v1/watch/w_7tIxfwKc?token=q-HX-..."

# → {
#   "status": "active",
#   "current": {
#     "mark": 61973.3,
#     "liquidation_price": 49909.99,
#     "distance_pct": 19.4653,
#     "funding_accum_est": -0.0005
#   },
#   "alerts": [
#     {"ts": "2026-06-11T02:44:45Z", "type": "liq_warn",
#      "payload": {"mark": 61995, "liquidation_price": 49910,
#                  "distance_pct": 19.49, "threshold_pct": 25}}
#   ],
#   ...
# }

(Those are real responses — that liq_warn is the first alert the watcher ever fired, on its first 60-second tick, against a monitor registered with a deliberately tight 25% warn threshold.)

Webhooks: signed, retried, SSRF-safe

Provide a webhook_url (any public http(s) endpoint) and alerts POST to you as JSON with two headers: X-QO-Monitor (the monitor id) and X-QO-Signature — an HMAC-SHA256 of the raw body, keyed with your monitor token. Verify in a few lines:

import crypto from "node:crypto";

function verifyWatchWebhook(rawBody: string, signature: string, token: string) {
  const expected = crypto.createHmac("sha256", token).update(rawBody).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}

A delivered alert body looks like:

{
  "monitor_id": "w_7tIxfwKc",
  "type": "liq_warn",
  "ts": 1781145885.81,
  "asset": "BTC",
  "direction": "long",
  "mark": 61995,
  "liquidation_price": 49910,
  "distance_pct": 19.49,
  "threshold_pct": 25,
  "funding_accum_est": -0.0001
}

Failed deliveries retry with backoff, and every alert is recorded server-side regardless — the status endpoint is the source of truth. Webhook targets are SSRF-guarded (public-unicast hosts only, re-checked at send time, redirects refused).

Production: $5 per position per 30 days, settled by your agent

POST /v1/watch/position is identical to the trial endpoint but runs 30 days. It's paid-only via x402: calling it unpaid returns a standard 402 quoting $5.00 USDC on Base or Solana, and any x402-capable client (Coinbase AgentKit, AgentCash, x402-fetch) completes payment automatically — no signup, no API key, no card. Renewal is the same motion: POST /v1/watch/extend with your {monitor_id, token} adds 30 days (it's also how a trial upgrades without re-registering).

The economics are deliberately lopsided: a DIY loop polling liquidation-price once a minute past the free tier costs ~$7.20/day in per-call fees. Watch is $5 for 30 days, checks just as often, folds in funding drift, and you don't babysit a scheduler.

The API surface

  • POST /v1/watch/trial — free 48h monitor, one per IP per 30 days
  • POST /v1/watch/position$5.00 / position / 30 days (x402)
  • POST /v1/watch/extend$5.00, +30 days, also upgrades a trial
  • GET /v1/watch/{monitor_id} — free status + alert history (token auth)
  • PATCH /v1/watch/{monitor_id} — free; update position params (added margin, resized, moved) so alerts keep tracking reality
  • DELETE /v1/watch/{monitor_id} — free cancel

All of it is exposed over MCP too — the hosted server at https://mcp.quantoracle.dev/mcp includes watch_trial, watch_position, and watch_extend alongside the other 76 tools, so an MCP agent can register a monitor as a tool call.

Design notes (what Watch deliberately is not)

Watch reads public market data and sends webhooks. It holds no exchange keys, no custody, no execution path — the worst possible failure is a missed alert, and a watcher heartbeat is published at /health (watcher_heartbeat_age_s) so you can verify the loop is alive before trusting it. Capacity is capped (200 active monitors, 5 per IP) so check cadence never degrades. Alerts are informational, not financial advice.

Related

Keep building

More tutorials on wiring deterministic quant tools into AI agents.

Try the calculators

The same computations this tutorial wires into an agent, runnable in the browser.