Query editor
with time as(SELECTgenerate_series('2020-11-11 00:00', NOW(), '1 day'::interval) as Date),eth_data as (select day, sum(coalesce(amount, 0)) over (order by day asc rows between unbounded preceding and current row) as eth_balanceFROM(SELECT date_trunc('day', block_time) as day, address, sum(amount)/1e18 as amountFROM (-- outbound transfersSELECT block_time, "from" AS address, -tr.value AS amountFROM ethereum.traces trWHERE "from" = '\x9a67F1940164d0318612b497E8e6038f902a00a4'AND successAND (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS null)UNION ALL-- inbound transfersSELECT block_time, "to" AS address, value AS amountFROM ethereum.tracesWHERE "to" = '\x9a67F1940164d0318612b497E8e6038f902a00a4'AND successAND (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS null)UNION ALL-- gas costsSELECT block_time, "from" AS address, -gas_used * gas_price AS amountFROM ethereum.transactionsWHERE "from" = '\x9a67F1940164d0318612b497E8e6038f902a00a4') tGROUP BY 1, 2)ed),eth_price as (select date_trunc('day', minute) as day, avg(price) as eth_pricefrom prices.usdwhere symbol = 'WETH'group by 1),weth_data AS(SELECTdate_trunc('day', block_time) as Date,COALESCE(sum(-e.value/1e18), 0) as weth_supplyFROM erc20."ERC20_evt_Transfer" eLEFT JOIN ethereum."transactions" tx ON evt_tx_hash = tx.hashWHERE "contract_address" = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -- weth contract addressand e."from" = '\x9a67F1940164d0318612b497E8e6038f902a00a4'GROUP BY 1UNION ALLSELECTdate_trunc('day', block_time) as Date,COALESCE(sum(e.value/1e18), 0) as weth_supply