cypherThorchain comparision first vs last 30 days
Updated 2022-04-21Copy 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
›
⌄
with first_n_pools as (select
'n_pools' as label,
count(distinct(iff(charindex('-', pool_name) = 0, pool_name, LEFT(pool_name, CHARINDEX('-', pool_name) - 1)))) as first
from thorchain.daily_pool_stats
where day >= '2021-4-11' and day <= '2021-5-11'),
last_n_pools as (select
'n_pools' as label,
count(distinct(iff(charindex('-', pool_name) = 0, pool_name, LEFT(pool_name, CHARINDEX('-', pool_name) - 1)))) as last
from thorchain.daily_pool_stats
where day >= current_date - 30),
n_pools as (select * from first_n_pools
full outer join last_n_pools using (label)),
first_n_swaps as (select
'n_swaps' as label,
count(distinct(tx_id)) as first
from thorchain.swaps
where block_timestamp >= '2021-4-11' and block_timestamp <= '2021-5-11'),
last_n_swaps as (select
'n_swaps' as label,
count(distinct(tx_id)) as last
from thorchain.swaps
where block_timestamp >= current_date - 30),
n_swaps as (select * from first_n_swaps
full outer join last_n_swaps using (label)),
first_swaps_volume as (select
'swaps_volume' as label,
sum(from_amount_usd) as first
from thorchain.swaps
where block_timestamp >= '2021-4-11' and block_timestamp <= '2021-5-11'),
Run a query to Download Data