Query editor
WITH latest_per_coin AS (SELECTcoin,MAX_BY(mark_px, time) AS latest_mark_px,MAX_BY(oracle_px, time) AS latest_oracle_px,MAX_BY(mid_px, time) AS latest_mid_px,MAX_BY(funding, time) AS latest_funding,MAX_BY(open_interest, time) AS latest_open_interest,MAX_BY(day_ntl_vlm, time) AS latest_day_ntl_vlm,MAX(time) AS latest_timeFROM hyperliquid.market_dataWHERE time >= CURRENT_TIMESTAMP - INTERVAL '7' DAYGROUP BY 1),seven_day AS (SELECTcoin,AVG(funding) AS avg_funding_7d,AVG(open_interest) AS avg_open_interest_7d,MAX(open_interest) AS max_open_interest_7d,AVG(day_ntl_vlm) AS avg_daily_notional_volume_7d,MAX(day_ntl_vlm) AS max_daily_notional_volume_7dFROM hyperliquid.market_dataWHERE time >= CURRENT_TIMESTAMP - INTERVAL '7' DAYGROUP BY 1)SELECTl.coin,l.latest_mark_px,l.latest_oracle_px,l.latest_mid_px,l.latest_funding,l.latest_open_interest,l.latest_day_ntl_vlm,s.avg_funding_7d,s.avg_open_interest_7d,s.max_open_interest_7d,s.avg_daily_notional_volume_7d,s.max_daily_notional_volume_7d,l.latest_timeFROM latest_per_coin lJOIN seven_day sON l.coin = s.coinORDER BY l.latest_day_ntl_vlm DESC NULLS LASTLIMIT 100