Eman-RazTransfers Volume By Direction Over Time
    Updated 2024-07-22
    with tab3 as (with tab1 as (select date_trunc('hour',block_timestamp) as date, tx_hash, platform, case when direction='outbound' then 'Aptos➡⛓'
    when direction='inbound' then '⛓➡Aptos' end as direction, sender, receiver, source_chain_name as source_chain,
    destination_chain_name as destination_chain, amount_unadj, token_address
    from aptos.defi.fact_bridge_activity
    where source_chain_name='Aptos' or
    destination_chain_name='Aptos'),

    tab2 as (select hour as date, token_address, symbol, price, decimals
    from aptos.price.ez_prices_hourly)

    select tab1.date as date, tx_hash,platform, direction, sender, receiver, source_chain, destination_chain,
    (amount_unadj/pow(10,decimals))*price as amount_usd, tab1.token_address as token_address, symbol
    from tab1 left join tab2 on tab1.date=tab2.date and tab1.token_address=tab2.token_address)

    select date_trunc('{{Time_Frame}}',date) as "Date", direction , count(distinct tx_hash) as "Transfers Count",
    count(distinct sender) as "Senders Count", count(distinct receiver) as "Receivers Count",
    sum(amount_usd) as "Transfers Volume ($USD)"
    from tab3
    where date::date between '{{Start_Date}}' and '{{End_Date}}'
    group by 1,2
    order by 1





    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived