HosseinUntitled Query
Updated 2022-11-09Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
›
⌄
with prices as (
select
date_trunc('day', timestamp) as day,
avg(price_usd) as price, symbol
from near.core.fact_prices
group by day, symbol
)
select
count(distinct (a.tx_hash)) "Volume",
count(distinct (tx_signer)) "Users",
count(distinct (pool_id)) "Pools",
sum (amount_in * price) as "Volume (USD)"
from near.core.fact_transactions a
join near.core.ez_dex_swaps b
join prices c
on a.tx_hash = b.tx_hash
and c.day = a.block_timestamp::date
and symbol = token_in
where tx_receiver like any ('v2.ref-%', '%-finance.near')
and tx_status = 'Success'
Run a query to Download Data