jackguyNEAR Distribution 2 copy
Updated 2023-10-19
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
›
⌄
-- forked from NEAR Distribution 2 @ https://flipsidecrypto.xyz/edit/queries/71c761af-7a6f-4a7f-bab7-15994b64498b
WITH tab1 as (
SELECT
tx_receiver,
sum(deposit / power(10, 24)) as in_volume
FROM near.core.fact_transfers
GROUP BY 1
), tab2 as (
SELECT
TX_SIGNER,
sum(deposit / power(10, 24)) as out_volume
FROM near.core.fact_transfers
GROUP BY 1
), tab3 as (
SELECT
*,
in_volume - out_volume as net_balance
FROM tab1
LEFT OUTER join tab2
on tx_signer = tx_receiver
HAVING net_balance > 0
)
SELECT
avg(net_balance),
median(net_balance),
max(net_balance)
FROM tab3
Run a query to Download Data