StangFAST base 4
Updated 2023-10-26
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
price AS
(
SELECT
date_trunc( 'day' , a.recorded_hour ) AS date
, avg( a.close ) AS price
, a.symbol AS symbol
, a.token_address AS address
FROM
solana.price.ez_token_prices_hourly a
GROUP BY 1 , 3 , 4
ORDER BY 1 DESC
)
SELECT
date_trunc( 'week' , a.block_timestamp ) AS "date"
, count( distinct a.signers[0] ) AS "swapper"
, count( distinct a.tx_id ) AS "swap count"
, sum( c.amount * d.price ) AS "swap volume"
, d.symbol AS "token"
, sum( "swapper" ) over ( partition BY "token" ORDER BY "date" ASC ) AS "total swapper"
, sum( "swap count" ) over ( partition BY "token" ORDER BY "date" ASC ) AS "total swap count"
, sum( "swap volume" ) over ( partition BY "token" ORDER BY "date" ASC ) AS "total swap volume"
FROM
solana.core.fact_transactions a
JOIN
lateral flatten (input => a.log_messages) e
Run a query to Download Data