Query editor
WITHMarketData AS (selectcoin, time as timestamp, oracle_px, lag(oracle_px) over (partition by coin order by time asc) as oracle_px_lag, 'minute' as resolution-- , mark_px-- , mid_px-- , impact_bid_px-- , impact_as_pxfrom hyperliquid.market_data T -- This table has 1 minute resolution price datawhere coin IN ('BTC', 'ETH', 'DOGE', 'FARTCOIN')--(coin IN ('BTC', 'DOGE', 'xyz:EUR', 'km:TSLA', 'km:GOLD')-- or coin like '%NVDA%'-- or coin like '%TSLA%'-- or coin like '%GOLD%'-- or coin like '%SILVER%'-- )-- NOTE 1-- Be cautious of what time range you choose-- Long time ranges (say 1 year) can result in timeout or too much data-- Best practice is to do all computation in SQL when working with large datasets,-- and output (ie the query output) a condensed post-processed analysis or smaller dataset-- that can then be downloaded locally to be analyzed with other tools (eg python)-- This query does all computation in SQL - it outputs the final empirical distribution values (ready for plotting).-- and T.time > TIMESTAMP '2025-09-01'and T.time < TIMESTAMP '2024-01-01'order by coin asc, time asc),PercChange AS (selectcoin, timestamp, oracle_px, oracle_px_lag, ((oracle_px - oracle_px_lag) / oracle_px_lag) * 100.0 as percent_changefrom MarketDataorder by coin asc, timestamp asc),-- HOURLY AS (-- select-- coin-- , DATE_TRUNC('HOUR', timestamp) AS timestamp-- , MIN(percent_change) as min_pc-- , approx_percentile(percent_change, 0.1) as p10_pc-- , approx_percentile(percent_change, 0.9) as p90_pc-- -- , PERCENTILE_DISC(0.1) WITHIN GROUP (ORDER BY percent_change) as p10_pc-- -- , PERCENTILE_DISC(0.9) WITHIN GROUP (ORDER BY percent_change) as p90_pc-- , MAX(percent_change) as max_pc-- from PercChange-- group by 1, 2-- ),DAILY AS (selectcoin, DATE_TRUNC('DAY', timestamp) AS timestamp