ZSaed5.1 swaps total daily
Updated 2023-03-15Copy Reference Fork
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
›
⌄
-- forked from 647e9c59-096c-4cdf-9237-0121e6ca1950
with clean as (select
a.* from near.social.fact_addkey_events a
INNER JOIN near.core.fact_transactions b on a.tx_hash = b.tx_hash and b.tx_status = 'Success'
where a.BLOCK_TIMESTAMP is not null
)
, singin as (
select min(BLOCK_TIMESTAMP) as day , SIGNER_ID as user from clean
group by user
)
, period as (
select day , user from singin
where day::date between '{{Start_from}}' and '{{End_At}}'
)
, price as (
select avg(price_usd) as usd , symbol , token_contract
from near.core.fact_prices
group by symbol , token_contract
)
select
BLOCK_TIMESTAMP::date as day ,
count(DISTINCT TX_HASH ) as num_tx,
count(DISTINCT TRADER) as num_user,
count(DISTINCT TOKEN_IN) as num_token_in,
count(DISTINCT TOKEN_OUT) as num_token_out,
count(distinct PLATFORM) as num_platform
from near.core.ez_dex_swaps
where TRADER in (select DISTINCT user from period )
group by day
Run a query to Download Data