mucrypto2023-08-26 01:37 AM
Updated 2023-08-25
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 resps as
(select defillama.get('/protocols', {}) as resp),
cex as (
select
value:category::string as category,
value:tvl::number as tvl
from resps,
lateral flatten (input => resp:data)
where category = 'CEX'),
defi as (
select
value:category::string as category,
value:tvl::number as tvl
from resps,
lateral flatten (input => resp:data)
where category not in ('CEX', 'Chain', 'Bridge')),
cex_tvl as (
select
sum(tvl) as cex_tvl
from cex),
defi_tvl as (
select
sum(tvl) as defi_tvl
from defi)
select
'CEX' as category,
cex_tvl as tvl
from cex_tvl
union all
Run a query to Download Data