CartanGroupmonthly volume and count and users
Updated 2024-01-16
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
saber as (
select
date_trunc('month', BLOCK_TIMESTAMP) as month,
SWAP_FROM_AMOUNT,
SWAP_FROM_MINT,
SWAP_TO_AMOUNT,
SWAP_TO_MINT,
SWAPPER,
TX_ID
from
solana.defi.fact_swaps
where
SWAP_PROGRAM = 'Saber Router'
),
price as (
select
date_trunc('month', RECORDED_HOUR) as month,
SYMBOL,
TOKEN_ADDRESS,
avg(CLOSE) as usd_price
from
solana.price.ez_token_prices_hourly
group by
1,
2,
3
)
select
saber.month,
sum(SWAP_FROM_AMOUNT * usd_price) as volume,
avg(SWAP_FROM_AMOUNT * usd_price) as avg,
count(distinct SWAPPER) as user,
count(distinct TX_ID) as count,
sum(volume) over (
order by
QueryRunArchived: QueryRun has been archived