kays0xDefillama API Demo copy
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
›
⌄
⌄
-- forked from Defillama API Demo @ https://flipsidecrypto.xyz/edit/queries/e87b0657-1a8d-4607-a5a6-8ce22ca5afb6
/* Query defillama API to list all protocols along
with summaries of their fees by chain (Ethereum only in this template) */
WITH
json AS (
SELECT
livequery.live.udf_api (
'https://api.llama.fi/overview/fees/ethereum?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFees'
) AS response
)
SELECT
VALUE:name::STRING as protocol,
REPLACE(REPLACE(VALUE:chains::STRING, '["', ''), '"]', '') as chain,
VALUE:total24h::INT as "24hfee",
VALUE:total30d::INT as "30dfee",
VALUE:methodology:Fees::STRING as description
FROM
json,
LATERAL FLATTEN(input => response:data:protocols)
WHERE
"24hfee" > 0
ORDER BY
3 DESC,
4 DESC
Run a query to Download Data