Query editor
with ankr_token_staking as (select time, net_trend, sum(net_trend) over (order by time) as total_staked_ankrfrom (select date_trunc('day', evt_block_time) as time, sum(amount/1e18) as net_trendfrom (select evt_block_time, cast(amount as double) as amountfrom ankr_ethereum.AnkrTokenStaking_evt_Delegated --delegated table, deposit ANKR tokenwhere evt_block_time >= date('2022-08-04') -- contract deployedunion allselect evt_block_time, (-1)*cast(amount as double) as amountfrom ankr_ethereum.AnkrTokenStaking_evt_Undelegated --undelegated table, withdraw ANKR tokenwhere evt_block_time >= date('2022-08-04') -- contract deployed) xgroup by 1order by 1 desc ) t),ankr_price as (select day as time, round(avg(price), 6) as avg_pricefrom(select date_trunc('day', minute) as day, pricefrom prices.usd where blockchain = 'ethereum' and symbol = 'ANKR') xgroup by 1order by 1 desc),tvl as (select time, total_staked_ankr, avg_price as ankr_price, total_staked_ankr*avg_price as tvlfrom ankr_token_stakingleft join ankr_price using (time))select *from tvlorder by time desc