Query editor
withjmx_price as (select date, first_value(jmx_price) over (partition by jmx_count order by date asc) as jmx_price from(select a.date as date, jmx_price, count(jmx_price) over (order by a.date asc) as jmx_count from(select date_trunc('day',minute) as date from prices.usdwhere symbol = 'ETH' and minute >= cast('2025-02-05 14:54' as timestamp)group by date_trunc('day',minute)) as aleft join(select date_trunc('day',block_time) as date, avg(case when token_sold_symbol = 'JMX' then token_bought_amount/token_sold_amount else token_sold_amount/token_bought_amount end) as jmx_price from aerodrome.tradeswhere token_pair = 'JMX-USDC'group by date_trunc('day',block_time)) as b on a.date = b.date) as aorder by a.date asc),jooce_price as (select date, first_value(jooce_price) over (partition by jooce_count order by date asc) as jooce_price from(select a.date as date, jooce_price, count(jooce_price) over (order by a.date asc) as jooce_count from(select date_trunc('day',minute) as date from prices.usdwhere symbol = 'ETH' and minute >= cast('2025-01-16 00:00' as timestamp)group by date_trunc('day',minute)) as aleft join(select date_trunc('day',block_time) as date, avg(case when token_bought_symbol = 'JOOCE' then amount_usd / token_bought_amount else amount_usd / token_sold_amount end) as jooce_price from uniswap.tradeswhere blockchain = 'base' and token_pair = 'JOOCE-WETH' and (token_bought_address = 0x100ce3e3391c00b6a52911313a4ea8d23c8a38d8 or token_sold_address = 0x100ce3e3391c00b6a52911313a4ea8d23c8a38d8)group by date_trunc('day',block_time)) as b on a.date = b.date) as aorder by a.date asc),uniswap_lp_revenue as(select a.date, amount0 * jooce_price + amount1 * eth_price as revenue_usd from(select date_trunc('day',evt_block_time) as date, sum(amount0)/1e18 as amount0,sum(amount1)/1e18 as amount1 from uniswap_v3_multichain.uniswapv3pool_evt_collectwhere chain = 'base' and contract_address = 0xa491C1F081f3c44047b5711f883d20342EdeF5e1group by date_trunc('day',evt_block_time)) as aleft join(select date_trunc('day',minute) as date, avg(price) as eth_price from prices.usdwhere symbol = 'ETH'group by date_trunc('day',minute)) as bon a.date = b.dateleft join(select date, jooce_price from jooce_price) as con a.date = c.dateorder by a.date asc),aerodrome_lp_revenue as(select a.date, amount0 * jmx_price + amount1 * usdc_price as revenue_usd from(select date_trunc('day',evt_block_time) as date, sum(amount0)/1e18 as amount0, sum(amount1)/1e6 as amount1 from aerodrome_base.pool_evt_claimwhere contract_address = 0x088a81Ad942008b480970B71687e736871C7f56egroup by date_trunc('day',evt_block_time)order by date_trunc('day',evt_block_time) asc) as aleft join(select date_trunc('day',minute) as date, avg(price) as usdc_price from prices.usdwhere symbol = 'USDC' and blockchain = 'ethereum'group by date_trunc('day',minute)) as bon a.date = b.dateleft join(select date, jmx_price from jmx_price) as c