niloUntitled Qu1ery
Updated 2022-11-18
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
with price_tab as (
select
block_hour::date as date,
asset_id,
avg (price_usd) as price
from algorand.defi.ez_price_pool_balances
group by 1,2)
select
DATE_TRUNC('day', block_timestamp) as date,
swap_program as exchanges,
count (distinct tx_group_id) as num_swaps,
count (distinct swapper) as num_swappers,
count (distinct POOL_ADDRESS) as num_pools,
sum (swap_from_amount*price) as volume
from algorand.defi.fact_swap a
join price_tab b
on a.swap_from_asset_id = b.asset_id
and a.block_timestamp::date = b.date
group by 1,2
Run a query to Download Data