CoinConverseGain or Lose (ETH to stETH) daily
Updated 2022-06-13
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
›
⌄
with eth_to_steth as (select block_timestamp::date as dt, sum(amount_in) as amount_from_ETH, sum(amount_out) as amount_to_stETH
from ethereum.core.ez_dex_swaps
where symbol_in = 'WETH'
and symbol_out = 'stETH'
and block_timestamp::date >= '2022-01-01'
group by 1),
eth_price as (select date(hour) as dt, avg(price) as eth_price_usd
from ethereum_core.fact_hourly_token_prices
where symbol in ('WETH')
group by 1),
steth_price as (select date(hour) as dt, avg(price) as steth_price_usd
from ethereum_core.fact_hourly_token_prices
where symbol in ('stETH')
group by 1)
select a.dt, (amount_to_stETH - amount_from_ETH) as ETH_gained,
sum(ETH_gained) over (order by a.dt asc) as cumulative_ETH_gained,
(amount_to_stETH - amount_from_ETH) / amount_from_ETH * 100 as percentage_difference,
eth_price_usd, steth_price_usd
from eth_to_steth a
left join eth_price b on
a.dt = b.dt
left join steth_price c on
a.dt = c.dt
Run a query to Download Data