HosseinUntitled Query
Updated 2022-12-18
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
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