maybeyonassushi_price_swap_vol
    Updated 2022-02-12
    with
    swaps as (
    select
    block_timestamp,
    pool_address,
    pool_name,
    tx_id,
    amount_usd
    from ethereum.dex_swaps
    where platform = 'sushiswap'
    and direction = 'IN'
    ),
    hour24 as (
    select
    date(block_timestamp) as date,
    -- pool_address,
    -- pool_name,
    count(tx_id) as swaps,
    sum(amount_usd) as vol,
    0.25*sum(amount_usd)/100 as fees
    from swaps
    where block_timestamp >= current_date - interval '30 days'
    and amount_usd is not null
    group by 1--,2
    ),
    sushi_price as (
    select
    hour as date,
    avg(price) as price
    from ethereum.token_prices_hourly
    where symbol = 'SUSHI'
    and hour >= current_date - interval '30 days'
    group by 1
    )

    select
    Run a query to Download Data