Ali3NTotal Bridges Stats (FLOW TOKEN)
    Updated 2023-05-15
    with pricet as (
    select recorded_hour::date as day,
    token,
    case when token = 'Blocto' then 'A.0f9df91c9121c460.BloctoToken'
    when token = 'FUSD' then 'A.3c5959b568896393.FUSD'
    when token = 'Flow' then 'A.1654653399040a61.FlowToken'
    when token = 'Rally' then 'A.231cc0dbbcffc4b7.RLY'
    when token = 'Revv' then 'A.d01e482eb680ec9f.REVV'
    when token = 'Sportium' then 'A.475755d2c9dccc3a.TeleportedSportiumToken'
    when token = 'Starly' then 'A.142fa6570b62fd97.StarlyToken'
    when token = 'USDC' then 'A.b19436aae4d94622.FiatToken'
    when token = 'USDT' then 'A.cfdd90d4a00f7b5b.TeleportedTetherToken'
    end as token_contract,
    avg (close) as USDPrice
    from flow.core.fact_hourly_prices
    group by 1,2,3)

    select direction,
    count (distinct tx_id) as TX_Count,
    count (distinct flow_wallet_address) as Wallets_Count,
    sum (amount) as Total_Token_Volume,
    sum (amount*usdprice) as Total_USD_Volume,
    avg (amount) as Average_Token_Volume,
    avg (amount*usdprice) as Average_USD_Volume,
    median (amount) as Median_Token_Volume,
    median (amount*usdprice) as Median_USD_Volume,
    min (amount) as Minimum_Token_Volume,
    min (amount*usdprice) as Minimum_USD_Volume,
    max (amount) as Maximum_Token_Volume,
    max (amount*usdprice) as Maximum_USD_Volume
    from flow.core.ez_bridge_transactions t1 join pricet t2 on t1.block_timestamp::date = t2.day and t1.token_contract = t2.token_contract
    where token ilike '{{Token_Symbol}}'
    group by 1
    order by 2 desc
    Run a query to Download Data