cypherCelsius Wallets - outgoing- average transactions size per token
    Updated 2022-11-28
    with wallets as (select address from flipside_prod_db.crosschain.address_labels
    where address_name = 'celsius wallet'),


    transactions3 as (select
    block_timestamp,
    tx_id,
    from_address,
    to_address,
    iff(contract_address is null, 'ETH', contract_address) as contract_address,
    symbol,
    amount,
    amount_usd
    from flipside_prod_db.ethereum.udm_events
    where block_timestamp >= current_date()-30
    and (from_address in (select * from wallets) and to_address not in (select * from wallets))),

    tx_values as (select
    t.block_timestamp,
    t.tx_id,
    t.from_address,
    t.to_address,
    t.contract_address,
    t.symbol,
    t.amount,
    c.price,
    iff(t.amount * c.price > 500000000, (t.amount/iff(contract_address = '0xc581b735a1688071a1746c968e0798d642ede491', 1e6, 1e18)) * c.price, t.amount * c.price) as value_usd
    from transactions3 t, ethereum.core.fact_hourly_token_prices c
    where t.contract_address = iff(c.token_address is null, 'ETH', c.token_address)
    and date_trunc('hour', t.block_timestamp) = c.hour)

    select symbol, avg(value_usd) as avg_value
    from tx_values
    where symbol is not null
    group by symbol
    Run a query to Download Data