Soheil_MKrETH Swap activity and peg to ETH
    Updated 2022-09-10
    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