Kruys-CollinsMetaPool General Stats
    Updated 2024-10-21
    SELECT
    'staking' AS activity_type,
    COUNT(action_id) AS transactions,
    COUNT(DISTINCT signer_id) AS users,
    SUM(deposit * 1e-24) AS total_amount,
    AVG(deposit * 1e-24) AS average_amount,
    (SELECT avg(price) from near.price.ez_prices_hourly where symbol = 'NEAR' AND date_trunc('day', hour) = current_date) as price_usd,
    price_usd * total_amount as "Volume in usd"
    FROM
    near.core.fact_actions_events_function_call
    WHERE receipt_succeeded = 'TRUE'
    AND receiver_id = 'meta-pool.near'
    AND method_name = 'deposit_and_stake'
    AND date_part('year',block_timestamp) >= 2023

    UNION ALL

    SELECT
    'unstaking' AS activity_type,
    COUNT(action_id) AS transactions,
    COUNT(DISTINCT signer_id) AS users,
    SUM(args:amount * 1e-24) AS total_amount,
    AVG(args:amount * 1e-24) AS average_amount,
    (SELECT avg(price) from near.price.ez_prices_hourly where symbol = 'NEAR' AND date_trunc('day', hour) = current_date) as price_usd,
    price_usd * total_amount as "Volume in usd"
    FROM
    near.core.fact_actions_events_function_call
    WHERE receipt_succeeded = 'TRUE'
    AND receiver_id = 'meta-pool.near'
    AND method_name IN ('unstake', 'unstake_all', 'liquid_unstake')
    AND date_part('year',block_timestamp) >= 2023


    QueryRunArchived: QueryRun has been archived