Query editor
withblocks as (selectdate_trunc('{{granularity}}', b.time) as time,avg(b.base_fee_per_gas/1e9) as gweifrom ethereum.blocks bwhere b.time > timestamp '{{start_date}}'group by 1),prices as (selectdate_trunc('{{granularity}}', p.minute) as time,avg(p.price) as pricefrom prices.usd pwhere p.minute > timestamp '{{start_date}}'and p.blockchain = 'ethereum'and p.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2group by 1)selectb.time,b.gwei,avg(b.gwei) over(order by b.time rows between {{ma_period}} preceding and current row) as gwei_ma,p.price,avg(p.price) over(order by b.time rows between {{ma_period}} preceding and current row) as price_ma,corr(p.price, b.gwei) over(order by b.time rows between {{corr_length}} preceding and current row) as price_gwei_corr,(b.gwei - lag(b.gwei) over(order by b.time)) / lag(b.gwei) over(order by b.time) as gwei_pct_change,(p.price - lag(p.price) over(order by b.time)) / lag(p.price) over(order by b.time) as price_pct_change,casewhen b.gwei > avg(b.gwei) over(order by b.time rows between {{ma_period}} preceding and current row) then 1else 0end as gwei_above_ma,casewhen p.price > avg(p.price) over(order by b.time rows between {{ma_period}} preceding and current row) then 1else 0end as price_above_ma,0.8 as high_correlation_thresholdfrom blocks bjoin prices p on b.time = p.timeorder by b.time-- limit 100