Query editor
WITHswaps AS (SELECTevt_block_time as block_time,date_trunc('day', evt_block_time) as day,CASEWHEN CAST(sold_id as integer) = 1 THEN 'sell'ELSE 'buy'END AS type,CASEWHEN CAST(sold_id as integer) = 1 THEN CAST(tokens_bought as DOUBLE) / CAST(tokens_sold as DOUBLE)ELSE CAST(tokens_sold as DOUBLE) / CAST(tokens_bought as DOUBLE)END AS price,SUM(CASEWHEN CAST(sold_id as integer) = 1 THEN tokens_sold / 1e18ELSE tokens_bought / 1e18END) OVER (PARTITION BYdate_trunc('day', evt_block_time)) AS volume,CASEWHEN CAST(sold_id as integer) = 1 THEN tokens_sold / 1e18ELSE tokens_bought / 1e18END AS oeth_amount,CASEWHEN CAST(sold_id as integer) = 0 THEN tokens_sold / 1e18ELSE tokens_bought / 1e18END AS eth_amountFROMcurvefi_ethereum.frxeth_eth_pool_evt_TokenExchange sWHEREevt_block_time >= timestamp '{{from_date}}'AND evt_block_time <= timestamp '{{to_date}}'AND contract_address = 0xa1F8A6807c402E4A15ef4EBa36528A3FED24E577-- AND contract_address = 0x9c3B46C0Ceb5B9e304FCd6D88Fc50f7DD24B31Bc),oracle_price AS (SELECTcall_block_time as block_time,-- call_block_number,-- call_tx_hash,date_trunc('day', call_block_time) as day,'oracle' as type,output_0 / 1e18 as price,null as volume,null oeth_amount,null as eth_amountFROMcurvefi_ethereum.frxeth_eth_pool_call_price_oracle pWHEREcall_block_time >= timestamp '{{from_date}}'AND call_block_time <= timestamp '{{to_date}}'AND contract_address = 0xa1F8A6807c402E4A15ef4EBa36528A3FED24E577),scale AS (SELECT*FROM