piperPool Depth
    Updated 2021-11-16
    /*
    17. [Hard] Pool Depth
    What is the current depth of each pool based on
    the number of LP-ers currently providing liquidity?

    Hint: use liquidity_actions
    */
    WITH
    pool_remove_liquidity AS (
    SELECT
    pool_name,
    from_address as address,
    (rune_amount_usd*-1) as rune_amount_usd
    FROM
    thorchain.liquidity_actions
    WHERE
    lp_action = 'remove_liquidity'
    ),
    pool_add_liquidity AS (
    SELECT
    pool_name,
    to_address as address,
    rune_amount_usd
    FROM
    thorchain.liquidity_actions
    WHERE
    lp_action = 'add_liquidity'
    ),
    all_liquidity AS (
    SELECT
    *
    FROM
    pool_remove_liquidity
    UNION ALL
    SELECT
    *
    Run a query to Download Data