BlockTrackerVolume by chain
    Updated 2025-01-25
    with data as (
    select
    block_timestamp,
    case when contains(pool_name,'-') then split(pool_name,'-')[0] else pool_name end as pool_name_,
    split(pool_name_ ,'.')[0] as chain,
    tx_id,
    from_address,
    from_amount_usd,
    to_amount_usd
    from thorchain.defi.fact_swaps
    where affiliate_address = 'll'
    )

    select
    date_trunc('{{granularity}}', block_timestamp) as date,
    chain,
    count(distinct tx_id) as n_txns,
    count(DISTINCT from_address) as n_users,
    sum(coalesce(from_amount_usd, to_amount_usd)) as volume
    from data
    where block_timestamp :: date >= '2024-10-18'
    group by 1 , 2





    Last run: 3 months ago
    DATE
    CHAIN
    N_TXNS
    N_USERS
    VOLUME
    1
    2024-11-13 00:00:00.000
    ETH
    1631605388249.59971773
    2
    2025-01-19 00:00:00.000
    ETH
    95982728782.68878181
    3
    2024-12-10 00:00:00.000
    BTC
    65641955000.42162581
    4
    2024-11-29 00:00:00.000
    BTC
    14141690539.49069017
    5
    2024-12-06 00:00:00.000
    ETH
    62592742496.10968714
    6
    2024-11-01 00:00:00.000
    BTC
    1713512217.074815991
    7
    2024-10-29 00:00:00.000
    ETH
    2016884256.593913891
    8
    2024-11-27 00:00:00.000
    ETH
    57532811072.91121084
    9
    2024-10-23 00:00:00.000
    BTC
    77249.516605744
    10
    2024-10-18 00:00:00.000
    ETH
    322413.896184811
    11
    2024-12-18 00:00:00.000
    ETH
    45471474714.34324931
    12
    2024-10-24 00:00:00.000
    ETH
    196387299.895181582
    13
    2025-01-13 00:00:00.000
    BTC
    37371551262.137181
    14
    2024-11-17 00:00:00.000
    BTC
    7470735597.653591366
    15
    2025-01-06 00:00:00.000
    BTC
    3729285655.946534493
    16
    2024-12-22 00:00:00.000
    BTC
    23221563506.01180676
    17
    2024-12-24 00:00:00.000
    BTC
    1313161390.415602513
    18
    2024-12-02 00:00:00.000
    BTC
    29291195655.53400439
    19
    2025-01-02 00:00:00.000
    ETH
    3232282922.993624367
    20
    2025-01-15 00:00:00.000
    BTC
    2421525603.779933217
    ...
    196
    11KB
    3s