Analytics Worker API

Comprehensive Deribit analytics with Key Levels & Market Intelligence

Overview

Purpose

Advanced analytics service providing key market levels, options flow analysis, and comprehensive market intelligence for BTC and ETH.

Features

17+ indicators, tiered caching, background refresh, professional-grade analytics with real-time data processing.

Currencies

BTC and ETH with comprehensive options and futures data analysis

Cache Strategy

5-minute TTL with local cache, KV cache, and background refresh for optimal performance

API Endpoints

GET /analytics Get comprehensive market analytics and key levels
Query Parameters
Parameter Type Required Description
currency string Optional Currency to analyze (BTC or ETH, default: BTC)
refresh boolean Optional Force refresh cache (true/false, default: false)
Response
{ "success": true, "data": { "key_levels": [ { "name": "24h High (Perp)", "value": 45000.0, "distance_to_spot": 2.5, "display_weight": 0.78, "confidence": 0.78, "method": "max trade price of the perpetual over Deribit rolling 24h stats window", "legacy_name": "1D Max" }, { "name": "Peak Call OI Strike 0-1DTE", "value": 44800.0, "distance_to_spot": 1.8, "display_weight": 0.69, "confidence": 0.69, "method": "as Peak Call OI Strike, restricted to the nearest expiry within 24h...", "legacy_name": "Call Resistance 0DTE" }, { "name": "Peak OI Imbalance 0-1DTE (Put-Heavy)", "value": 44500.0, "distance_to_spot": 0.5, "display_weight": 0.6, "confidence": 0.6, "method": "strike maximising |sum of proximity-weighted (call OI - put OI)| over 0-1DTE instruments; negative => more put OI. NOT gamma, NOT dealer positioning", "legacy_name": "Gamma Wall (Short Gamma)" } ], "metadata": { "schema_version": 2, "currency": "BTC", "spot_price": 44850.0, "put_call_ratios": { "0-1DTE": { "value": 1.2, "sample_count": 14, "method": "put OI / call OI, summed over at most 10 OTM strikes per side inside an IV-scaled band; NOT a whole-book put/call ratio", "bucket": "0-1DTE", "band_pct": 16.4, "call_oi": 812.0, "put_oi": 974.4, "call_strikes_used": 7, "put_strikes_used": 7 }, "1W": { "value": null, "sample_count": 0, "method": "..." } }, "iv_data": { "other_expiries": { "value": 45.2, "sample_count": 118, "method": "mean mark_iv of instruments within 5% of spot in this expiry bucket" }, "dte0_1": { "value": 52.8, "sample_count": 22, "method": "..." }, "week1": { "value": null, "sample_count": 0, "method": "..." }, "month1": { "value": 42.3, "sample_count": 46, "method": "..." } }, "omitted_levels": [ { "name": "Peak Call OI Strike 1W", "reason": "ATM IV unmeasured for bucket '1W': none of its 63 instruments lie within 5% of spot carrying a positive mark_iv, so the strike-selection band is undefined" } ], "instruments_in_book": 1250, "strikes_used_total": 54, "instruments_analyzed": 1250, "bucket_instrument_counts": { "Other Expiries": 688, "0-1DTE": 44, "1W": 63, "1M": 121 }, "flow_stats": { "trades_considered": 3200, "trades_unparseable": 0, "trades_without_delta": 41, "trades_with_delta": 3159, "strikes_seen": 214, "total_premium_usd": 18422900.55 }, "futures_trades": 8500, "options_trades": 3200, "cache_info": { "coverage_verified": true, "incremental": true } }, "timestamp": "2024-01-01T12:00:00.000Z" } }
200 OK 400 Bad Request 500 Internal Error

CORS Configuration

All origins are allowed for CORS access with the following headers:

Schema v2 — breaking rename (what these numbers are, and are not)

Several published quantities previously carried names borrowed from options terms of art that the computation did not implement. Those names have been corrected. Each level now also carries a method string stating exactly what was computed, and a legacy_name giving its former name for migration.

Two guarantees apply to every field:

Former nameCurrent nameWhy it changed
Gamma Wall (Long/Short Gamma) Peak OI Imbalance 0-1DTE (Call-Heavy/Put-Heavy) Contained no gamma. Put gamma is positive and equals call gamma at the same strike (put–call parity), so negating the put leg produced a call-minus-put open-interest difference, not gamma. "Long/Short Gamma" additionally asserts dealer positioning, which nothing in the pipeline computes.
Max Pain Flow Peak Two-Sided Premium Strike (24h) Never minimised an intrinsic payout. It is the strike with the most two-sided traded premium, pooling all expiries.
Call Resistance / Put Support Peak Call OI Strike / Peak Put OI Strike An open-interest proxy among at most 10 OTM strikes in an IV-scaled band — not a demonstrated price barrier.
HVL Peak Futures Volume Price (24h) Pools perpetual and dated futures at raw, non-basis-adjusted prices.
HVS / VWAS Peak Options Premium Strike / Premium-Weighted Mean Strike Premium-USD-weighted, not contract-weighted. The two rank different strikes, frequently on opposite sides of spot.
Call Flow Resistance / Put Flow Support Peak Call/Put Delta-Flow Strike Now uses a real signed Black–Scholes delta and a signed flow. The put side previously took an absolute value, so selling pressure ranked identically to buying pressure.
0DTE bucket0-1DTE Deribit expires at 08:00 UTC, so the ≤24h test selects tomorrow's expiry for 16 hours of each day.
Current ratio bucketOther Expiries It is the residual bucket (~80% of the book, 0–332 DTE), not an "overall" or front-month reading.
confidencedisplay_weight Deprecated alias, still emitted. It was never a confidence or a probability: a hand-assigned per-level constant times a linear distance decay, with no dependence on open interest, trade count, notional, dispersion or realised hit rate. Do not render it as a percentage confidence.
instruments_analyzedinstruments_in_book Deprecated alias, still emitted. It counts the whole option book, not the strikes that fed any published level (see strikes_used_total).

Deprecated aliases confidence, instruments_analyzed and every legacy_name are emitted for one migration cycle and will be removed. Branch on metadata.schema_version.

Analytics Indicators

Price Levels
  • 24h High/Low (Perp) — perpetual only
  • Peak Futures Volume Price (24h) — no basis adjustment
  • Premium-Weighted Mean Strike (24h)
Open-Interest Levels
  • Peak Call/Put OI Strike (≤10 OTM strikes per side)
  • Peak OI Imbalance 0-1DTE (call OI − put OI)
  • 0-1DTE, 1W, 1M, Other Expiries buckets
  • Banded put/call OI ratios (not whole-book)
Flow Analysis (traded premium)
  • Peak Options Premium Strike (24h)
  • Peak Two-Sided Premium Strike (24h)
  • Peak Call/Put Delta-Flow Strike (signed BS delta)
  • 12h e-folding time decay
Volatility Data
  • ATM implied volatility per expiry bucket
  • null + sample_count when unmeasurable
  • IV-scaled strike-selection bands
  • Levels withheld when the band is undefined

Technical Features

Caching System

Tiered caching with local cache, KV cache, and 5-minute TTL with background refresh

Data Sources

Deribit API v2 with parallel fetching, retry logic, and rate limiting

Performance

Parallel data fetching, optimized chunk processing, and exponential backoff

Display Weight (not confidence)

A presentation prior for render order only: a hand-assigned per-level constant times a linear distance decay. It is not a probability and is not derived from any measurement. Published as display_weight; confidence is a deprecated alias carrying the identical value.

Data Timeframes

Real-time

Spot prices, current options data, and live market conditions

24-hour

Historical trades, volume profiles, and daily statistics

Expiry Analysis

0DTE, current weekly/monthly, 1-week, and 1-month expiries

Cache Duration

5-minute cache with background refresh starting at 4 minutes

Error Handling

Invalid Currency

Returns 400 error for unsupported currencies (only BTC/ETH supported)

API Failures

3-retry logic with exponential backoff for Deribit API calls

Upstream Rate Limits

Deribit 429 responses are retried with exponential backoff. If every retry fails the run raises rather than returning an empty result, so a partial fetch can never be published as complete. The PUT endpoint itself is not rate limited; the shared secret is the gate.

Cache Fallback

Graceful degradation to cached data when fresh data unavailable