Query editor
WITH days_seq AS (SELECTsequence(date('2021-06-14'), date_trunc('day', cast(now() as timestamp)), interval '1' day) AS days),dates as (SELECT days.dayFROM days_seqCROSS JOIN unnest(days) AS days(day)),index as (SELECTdate_trunc('day', evt_block_time) as day, avg(index) as indexFROM query_3404270GROUP BY 1),ohm_v1_inflows as (SELECT date_trunc('day', evt_block_time) as day, (SUM(value) OVER(ORDER BY evt_block_time))/1e9 as total_inflowsFROM erc20_ethereum.evt_TransferWHERE "to" = 0xFd31c7d00Ca47653c6Ce64Af53c1571f9C36566aAND contract_address = 0x383518188C0C6d7730D91b2c03a03C837814a899ORDER BY 1 DESC),ohm_v1_outflows as (SELECT date_trunc('day', evt_block_time) as day, (SUM(value) OVER(ORDER BY evt_block_time))/1e9 as total_outflowsFROM erc20_ethereum.evt_TransferWHERE "from" = 0xFd31c7d00Ca47653c6Ce64Af53c1571f9C36566aAND contract_address = 0x383518188C0C6d7730D91b2c03a03C837814a899ORDER BY 1 DESC),ohm_v2_inflows as (SELECT date_trunc('day', evt_block_time) as day, (SUM(value) OVER(ORDER BY evt_block_time))/1e9 as total_inflowsFROM erc20_ethereum.evt_TransferWHERE "to" = 0xB63cac384247597756545b500253ff8E607a8020AND contract_address = 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5ORDER BY 1 DESC),ohm_v2_outflows as (SELECT date_trunc('day', evt_block_time) as day, (SUM(value) OVER(ORDER BY evt_block_time))/1e9 as total_outflowsFROM erc20_ethereum.evt_TransferWHERE "from" = 0xB63cac384247597756545b500253ff8E607a8020AND contract_address = 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5ORDER BY 1 DESC)SELECTdistinct a.day as day, avg(D.index) as index, max(b.total_inflows) as total_ohmv1_staked, max(c.total_outflows) as total_ohmv1_unstaked, max(b.total_inflows)-max(c.total_outflows) as ohmv1_staked, (max(b.total_inflows)-max(c.total_outflows)) / avg(D.index) as gohm_staked_V1