StangFAST003 - growth
Updated 2024-05-27
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
›
⌄
-- forked from 002 - defi @ https://flipsidecrypto.xyz/edit/queries/f9461525-b925-410a-bdfa-7dcf6ab463ba
-- forked from overview @ https://flipsidecrypto.xyz/edit/queries/8b459c15-4875-436f-bbc2-bb836742a105
with
price AS
(
SELECT
date_trunc( 'day' , a.recorded_hour ) AS date
, avg( a.close ) AS price
, a.symbol AS token
FROM
solana.price.ez_token_prices_hourly a
WHERE
a.symbol = 'sol'
GROUP BY 1 , 3
ORDER BY 1 DESC
)
SELECT
date_trunc( '{{period}}' , a.block_timestamp ) AS "date"
, count( DISTINCT a.signers ) AS "users"
, lag( "users" , 1 ) over ( ORDER BY "date" ASC ) AS "lags"
, "users" - "lags" AS "change"
, round( ( "change" / "lags" ) * 100 , 2 ) AS "growth"
, case when "growth" < 0 then 'Decrease ( % )' else 'Increase ( % ) ' end AS " Growth "
FROM
solana.core.fact_events a
QueryRunArchived: QueryRun has been archived