Query editor
-- Briber ROI buyer leaderboard: LATEST settled epoch only (consistent with hero), real buyers (bribe >= $1,000), with 4-epoch leverage trend.WITH base AS (SELECT entity, e, leverage, bribe_usd, cost_per_fee, fees_directed_usd, emissions_directed_usd, is_unattributed FROM dune.hollywood41x.result_briber_roi),me AS (SELECT max(e) m FROM base),r AS (SELECT b.*, row_number() OVER (PARTITION BY entity ORDER BY e DESC) rn FROM base b),slope AS (SELECT entity, regr_slope(leverage, CAST(e AS double)) slope4 FROM r WHERE rn<=4 GROUP BY entity),cur AS (SELECT * FROM base WHERE e=(SELECT m FROM me))SELECT cur.entity, cur.bribe_usd, cur.emissions_directed_usd, cur.leverage, cur.fees_directed_usd, cur.cost_per_fee,CASE WHEN s.slope4 > 0.05 THEN U&'\2191 rising' WHEN s.slope4 < -0.05 THEN U&'\2193 decaying' ELSE U&'\2192 flat' END trend,cur.is_unattributedFROM cur LEFT JOIN slope s ON s.entity=cur.entityWHERE cur.bribe_usd >= 1000ORDER BY cur.bribe_usd DESC