farid-c9j0VMWeekly total Loss and Gain from ETH to stETH
Updated 2022-06-13Copy Reference Fork
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
27
28
29
30
31
32
33
34
35
36
›
⌄
WITH stETH as (
SELECT
date_trunc('week', hour) as week,
avg(price) as stETH_price
FROM ethereum.token_prices_hourly
WHERE token_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
GROUP BY 1
),
eth as (
SELECT
date_trunc('week', hour) as week,
avg(price) as ETH_price
FROM ethereum.token_prices_hourly
WHERE token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
GROUP BY 1
),
peg as (
SELECT
stETH.week,
stETH.stETH_price as steth,
eth.ETH_price as eth,
steth / eth as price_peg
FROM stETH
LEFT OUTER JOIN eth
ON stETH.week = eth.week
),
buy_eth as (
SELECT
date_trunc('week', block_timestamp) as week,
sum(amount_in) as ETH_amount,
COUNT(to_address) as users
FROM ethereum.dex_swaps
WHERE pool_address = '0x4028daac072e492d34a3afdbef0ba7e35d8b55c4'
AND token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
Run a query to Download Data