Hessish open - eth vs users swaps
    Updated 2022-09-29
    with datas as (
    SELECT BLOCK_TIMESTAMP::date as date, sum(AMOUNT_in) as volume, sum(AMOUNT_in_USD) as usd,count (distinct TX_HASH) as txs
    from ethereum.core.ez_dex_swaps
    where ORIGIN_FROM_ADDRESS not in (SELECT DISTINCT miner from
    ethereum.core.fact_blocks)
    and BLOCK_TIMESTAMP::date >= '2022-09-15'
    and SYMBOL_IN = 'WETH'
    GROUP by 1),

    ethprice as (SELECT hour::date as datex, avg(price) as price
    FROM flipside_prod_db.ethereum.token_prices_hourly
    where symbol = 'WETH'
    and hour::date >= CURRENT_DATE -365
    GROUP by 1)
    SELECT *, price, sum(volume) over (order by date) as cum_vol, sum(usd) over (order by date) as cum_usd, sum(txs) over (order by date) as cum_txs
    from datas
    join ethprice
    on datex=date
    order by 1
    Run a query to Download Data