hessTotal III
    Updated 2025-01-29
    with liquidity as (select block_timestamp,
    lp_action,
    pool_name,
    ifnull(from_address,ASSET_ADDRESS) as user,
    rune_amount_usd,
    asset_amount_usd,
    rune_amount_usd+asset_amount_usd as amount_usd
    from thorchain.defi.fact_liquidity_actions
    where block_timestamp::date >= '2024-01-01')
    ,
    provide as ( select
    count(DISTINCT user) as delegators,
    sum(amount_usd) as add_volume,
    count(*) as add_liquidity_tx,
    avg(amount_usd) as avg_volume
    from liquidity
    where lp_action = 'add_liquidity'
    )
    ,
    remove as ( select
    count(DISTINCT user)*-1 as undelegators,
    sum(amount_usd)*-1 as remove_volume,
    count(*)*-1 as remove_liquidity_tx
    from liquidity
    where lp_action = 'remove_liquidity'

    )


    select *
    from provide


    Last run: 3 months ago
    DELEGATORS
    ADD_VOLUME
    ADD_LIQUIDITY_TX
    AVG_VOLUME
    1
    9721191904533.013567284759673.919114105
    1
    46B
    2s