hbd19942023-11-19 09:58 AM
Updated 2023-11-19
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 base as (
SELECT
'Avalanche' as network,
BLOCK_TIMESTAMP,
TX_HASH,
ORIGIN_FROM_ADDRESS,
ORIGIN_TO_ADDRESS,
CONTRACT_ADDRESS,
POOL_NAME,
TOKEN_IN,
SYMBOL_IN,
AMOUNT_IN,
AMOUNT_IN_USD,
TOKEN_OUT,
SYMBOL_OUT,
AMOUNT_OUT,
AMOUNT_OUT_USD,
coalesce(AMOUNT_IN_USD,AMOUNT_OUT_USD) as swap_volume
from avalanche.defi.ez_dex_swaps
where PLATFORM ilike '%uniswap%')
select
network as "Network",
date_trunc('week',BLOCK_TIMESTAMP::date) as "Date",
count(distinct tx_hash) as "Swap Transactions",
count(*) as "Swaps",
lag("Swaps") over (partition by "Network" order by "Date") as "Previous Month Swaps",
(("Swaps" - "Previous Month Swaps") / "Previous Month Swaps" * 100) as "Change Rate (%)",
case
when "Previous Month Swaps" > "Swaps" then '🔴'
when "Previous Month Swaps" < "Swaps" then '🟢'
when "Previous Month Swaps" = "Swaps" then '⚪'
end as "Status",
"Status" || ' | ' || "Change Rate (%)" as "Change Rate Status",
Run a query to Download Data