Soheil_MKrETH Swap activity and peg to ETH
Updated 2022-09-10
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 swap_from as(
SELECT
BLOCK_TIMESTAMP::date as date,
count(distinct(TX_HASH)) as sfrom
from ethereum.core.ez_dex_swaps
where SYMBOL_IN ='rETH'
group by 1
),
swap_to as(
SELECT
BLOCK_TIMESTAMP::date as date,
count(distinct(TX_HASH)) as sto
from ethereum.core.ez_dex_swaps
where SYMBOL_OUT ='rETH'
group by 1
),
T1 as (
select
a.date,
-a.sfrom as swap_from_rETH,
b.sto as swap_to_rETH
from swap_from a
join swap_to b
on a.date=b.date
group by 1,2,3
),
eth_price as (
select
date_trunc('day',HOUR) as date,
round(avg(price)) as eth_price
from ethereum.core.fact_hourly_token_prices
Run a query to Download Data