Soheil_MKUntitled Query
    Updated 2022-11-23
    with from_ETH as (
    select
    BLOCK_TIMESTAMP::date as date,
    count(distinct TX_HASH) as txs,
    count(distinct ORIGIN_FROM_ADDRESS) as users,
    sum(AMOUNT_IN_USD) as usd_value


    from ethereum.core.ez_dex_swaps
    where SYMBOL_IN ='WETH'
    and EVENT_NAME='Swap'
    and date>='2022-11-01'
    group by 1
    ),

    to_ETH as (
    select
    BLOCK_TIMESTAMP::date as date,
    count(distinct TX_HASH) as txs,
    count(distinct ORIGIN_FROM_ADDRESS) as users,
    sum(AMOUNT_IN_USD) as usd_value


    from ethereum.core.ez_dex_swaps
    where SYMBOL_OUT ='WETH'
    and EVENT_NAME='Swap'
    and date>='2022-11-01'
    group by 1
    )

    select
    a.date,
    -1*a.usd_value as from_ETH_USD_Value,
    b.usd_value as to_ETH_USD_Value,
    sum(-1*a.usd_value+b.usd_value) over (order by a.date) as cum_usd_value
    from from_ETH a
    Run a query to Download Data