MuzeJoe Price
Updated 2023-04-05
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 prices as (
select
date_trunc('day', recorded_hour) as day,
avg( close ) as price
from crosschain.core.fact_hourly_prices
where id = 'joe'
group by 1
),
volume as (
select
date as day,
sum( volume ) as volume
from external.defillama.fact_dex_volume
where chain = 'avalanche'
and protocol in ( 'joe v2', 'trader joe dex')
group by 1
)
select
a.day,
volume,
price,
sum( volume ) over(order by a.day) as cum_volume
from prices a
left join volume b on a.day = b.day
where a.day <= current_date - interval '3 days'
-- group by 1
order by 1 desc
Run a query to Download Data