Updated 2024-11-02
    with

    main as (
    select
    tx_id,
    block_timestamp,
    from_address as user,
    split(pool_name, '-')[0] as pool_name,
    lp_action,
    nvl(rune_amount_usd, asset_amount_usd) as amount_usd
    from
    thorchain.defi.fact_liquidity_actions
    where
    split(pool_name, '-')[0] in ('AVAX.USDC', 'AVAX.SOL', 'AVAX.AVAX')
    and block_timestamp between '{{ start_date }}' and '{{ end_date }}'
    )

    select
    pool_name,
    lp_action,
    count(distinct tx_id) as transactions,
    count(distinct user) as users,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as average_amount_usd
    from
    main
    group by 1, 2
    order by 1, 2
    QueryRunArchived: QueryRun has been archived