Query editor
WITH raw AS (SELECT json_parse(http_post('https://api.hyperliquid.xyz/info','{"type":"metaAndAssetCtxs", "dex": "vntl"}',ARRAY['Content-Type: application/json'])) AS data), universe AS (SELECTt.idx,REPLACE(CAST(json_extract_scalar(t.item, '$.name') AS VARCHAR), 'vntl:', '') AS market,COALESCE(CAST(json_extract_scalar(t.item, '$.isDelisted') AS BOOLEAN), FALSE) AS is_delistedFROM rawCROSS JOIN UNNEST(CAST(json_extract(data, '$[0].universe') AS ARRAY(JSON))) WITH ORDINALITY AS t(item, idx)), contexts AS (SELECTt.idx,CAST(json_extract_scalar(t.item, '$.openInterest') AS DOUBLE) AS oi_raw,CAST(json_extract_scalar(t.item, '$.markPx') AS DOUBLE) AS mark_px,CAST(json_extract_scalar(t.item, '$.funding') AS DOUBLE) AS funding,CAST(json_extract_scalar(t.item, '$.dayNtlVlm') AS DOUBLE) AS volume_24h,CAST(json_extract_scalar(t.item, '$.impactPxs[0]') AS DOUBLE) AS impact_bid,CAST(json_extract_scalar(t.item, '$.impactPxs[1]') AS DOUBLE) AS impact_ask,CAST(json_extract_scalar(t.item, '$.midPx') AS DOUBLE) AS mid_pxFROM rawCROSS JOIN UNNEST(CAST(json_extract(data, '$[1]') AS ARRAY(JSON))) WITH ORDINALITY AS t(item, idx))SELECTu.market,c.oi_raw * c.mark_px AS oi_usd,c.volume_24h AS volume_24h_usd,ROUND(ABS(c.funding * 24 * 365 * 100), 1) AS abs_funding_ann_pct,CASE WHEN c.mid_px > 0 AND c.impact_bid IS NOT NULLTHEN ROUND((c.impact_ask - c.impact_bid) / c.mid_px * 10000, 1)ELSE NULLEND AS spread_bps,c.volume_24h / NULLIF(c.oi_raw * c.mark_px, 0) AS turnoverFROM universe uINNER JOIN contexts c ON u.idx = c.idxWHERE NOT u.is_delisted AND c.oi_raw > 0