HosseinUntitled Query
    Updated 2022-12-18
    with prices as (
    select
    timestamp::date as day,
    avg(price_usd) as near_price_usd
    from near.core.fact_prices
    where symbol = 'wNEAR'
    group by 1
    ),
    t1 as (
    select
    tx_hash,
    tx_signer,
    tx_receiver as validator,
    deposit/1e24 as amount,
    amount * near_price_usd as amount_usd
    from near.core.fact_actions_events_function_call a
    join near.core.fact_transactions b
    using (tx_hash)
    join prices
    on block_timestamp::date = day
    where method_name = 'deposit_and_stake'
    and block_timestamp::date >= current_date - interval '3 months'
    and tx_status = 'Success'
    )

    select
    case
    when amount_usd < 10 then 'Less than 10 $'
    when amount_usd < 100 then 'Between 10 $ - 100 $'
    when amount_usd < 1000 then 'Between 100 $ - 1000 $'
    when amount_usd < 10000 then 'Between 1000 $ - 10k $'
    when amount_usd < 100000 then 'Between 10k $ - 100k $'
    else 'More than 100k $'
    end as type,
    count(distinct(tx_hash)) as tx_count
    Run a query to Download Data