Query editor
with calendar AS (with day_seq as(SELECT( sequence(cast('2020-11-01' as date),cast(now() as date), interval '1' day)) day )select days.dayfrom day_seqcross join unnest(day) as days(day)), lido_deposits_daily as (SELECT date_trunc('day',block_time) as time, sum(cast(value as DOUBLE))/1e18 as lido_depositedFROM ethereum.tracesWHERE to = 0x00000000219ab540356cbb839cbe05303d7705faAND call_type = 'call'AND success = TrueAND "from" in (0xae7ab96520de3a18e5e111b5eaab095312d7fe84, 0xB9D7934878B5FB9610B3fE8A5e441e8fad7E293f, 0xFdDf38947aFB03C621C71b06C9C70bce73f12999)GROUP BY 1), lido_all_withdrawals_daily as (select block_time as time, sum(amount)/1e9 as amount,sum(CASE WHEN amount/1e9 BETWEEN 20 AND 32 THEN CAST(amount as double)/1e9WHEN amount/1e9 > 32 THEN 32 ELSE 0 END) AS withdrawn_principalfrom ethereum.withdrawalswhere address = 0xB9D7934878B5FB9610B3fE8A5e441e8fad7E293fgroup by 1), lido_principal_withdrawals_daily as (selectdate_trunc('day',time) as time,(-1) * sum(withdrawn_principal) as amountfrom lido_all_withdrawals_dailywhere withdrawn_principal > 0group by 1), lido_buffer_amounts_daily as (select * from query_2481449 --Lido protocol buffer),eth_prices AS (SELECT DISTINCTDATE_TRUNC('day', minute) AS day,LAST_VALUE(price) OVER (PARTITION BYDATE_TRUNC('day', minute)ORDER BYminute range BETWEEN unbounded precedingAND unbounded following) AS priceFROMprices."usd" AS pWHEREp.blockchain = 'ethereum'AND DATE_TRUNC('day', minute) >= CAST('2020-12-20' AS TIMESTAMP)