permarypagnolin vilume
Updated 2024-11-02
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
›
⌄
with quarterly_data as (
select
DATE_TRUNC('day', date) as day,
protocol,
chain,
case
when date >= '2024-01-01' and date < '2024-04-01' then 'Q1-2024'
when date >= '2024-04-01' and date < '2024-07-01' then 'Q2-2024'
when date >= '2024-07-01' and date < '2024-10-01' then 'Q3-2024'
when date >= '2024-10-01' and date < '2025-01-01' then 'Q4-2024'
END as quarter,
SUM(volume) as daily_volume
from external.defillama.fact_dex_volume
WHERE protocol ILIKE '%pangolin%'
and chain ILIKE '%Avalanche%'
and date between '2024-01-01' and '2024-12-31'
group by DATE_TRUNC('day', date), protocol, chain, quarter
),
cumulative_quarterly_volume as (
select
day,
protocol,
chain,
quarter,
SUM(daily_volume) over (partition by protocol, quarter order by day) as cumulative_volume
from quarterly_data
)
select * from cumulative_quarterly_volume
order by day, protocol;
QueryRunArchived: QueryRun has been archived