kiacrypto Total volume Vs. Average volume per tx
    Updated 2022-08-20
    with vol as (
    select block_timestamp::date as date, raw_amount/1e18 as vol
    from optimism.core.fact_token_transfers
    where to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1' and origin_to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1' and origin_from_address = from_address and
    block_timestamp::date between current_date - 14 and current_date - 1 and contract_address in ('0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9', '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1')
    union all
    select block_timestamp::date as date, raw_amount/1e6 as vol
    from optimism.core.fact_token_transfers
    where to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1' and origin_to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1' and origin_from_address = from_address and
    block_timestamp::date between current_date - 14 and current_date - 1 and contract_address in ('0x7f5c764cbc14f9669b88837ca1490cca17c31607', '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58')
    ),
    total_vol as (
    select sum(vol) as total_volume
    from vol
    ),
    daily_vol as (
    select date, sum(vol) as volume, avg(vol) as avg_volume
    from vol
    group by 1
    )
    select date, volume, avg_volume, total_volume
    from total_vol, daily_vol
    Run a query to Download Data