azerbaijanCopy of Copy of Copy of Untitled Query
Updated 2022-11-20Copy 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
36
›
⌄
⌄
⌄
select *
from(
SELECT
BLOCK_TIMESTAMP::date as date,
PROGRAM_ID,
case when PROGRAM_ID ='srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX' then 'Openbook' else PROGRAM_ID end as platform,
count(distinct TX_ID ) as txs,
rank() over(partition by date order by txs desc) as rank
/* label,
count(DISTINCT tx_id) as events,
count(DISTINCT INSTRUCTION:accounts[1]) as users*/
FROM solana.core.fact_events e
-- join solana.core.dim_labels l on e.program_id = l.address
-- WHERE label_type IN ('dex', 'defi')
where block_timestamp >= '2022-11-01'
--and PROGRAM_ID ='srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX'
group by 1,2,3)
having rank<=10
/* ,case when PROGRAM_ID ='srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX' then 'Openbook' else label end as platform,
from final join
--group by 1,2
having rank<=10
--and
-- GROUP BY 1
-- ORDER by 2 DESC
-- LIMIT 15
/*select period,
avg( events) as avg_events,
avg( users) as avg_users
from(
SELECT
date_trunc('day', block_timestamp) as day,
case when day >= '2022-11-08' then 'After FTX news' else 'Before FTX news' end as period,
Run a query to Download Data