binhachonMarket Volatility - #4
    Updated 2022-05-22
    with swap_transactions as (
    select
    block_timestamp,
    symbol_in as symbol,
    token_in as contract_address,
    amount_in_usd as selling_volume,
    0 as buying_volume
    from flipside_prod_db.ethereum_core.ez_dex_swaps
    where block_timestamp::date >= '2022-05-09'
    and block_timestamp::date <= '2022-05-15'
    and symbol_in is not null
    and amount_in_usd is not null
    union all
    select
    block_timestamp,
    symbol_out,
    token_out as contract_address,
    0 as selling_volume,
    amount_out_usd as buying_volume
    from flipside_prod_db.ethereum_core.ez_dex_swaps
    where block_timestamp::date >= '2022-05-09'
    and block_timestamp::date <= '2022-05-15'
    and symbol_out is not null
    and amount_out_usd is not null
    )
    select
    date_trunc('day', block_timestamp) as time,
    symbol,
    contract_address,
    sum(selling_volume) as daily_selling_volume,
    sum(buying_volume) as daily_buying_volume,
    daily_buying_volume + daily_selling_volume as daily_net_volume,
    count(*) as number_of_trades
    from swap_transactions
    where symbol != 'PN'
    group by 1, 2, 3
    Run a query to Download Data