boomer77Untitled Query
Updated 2021-11-24
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
›
⌄
with ust_supply as (
select sum(balance) as total_ust_sup, currency, date
from terra.daily_balances
where currency = 'UST'
and date > CURRENT_DATE - 30
group by 2,3
),
luna_swap_volume as (
select sum(offer_amount_usd) as total_volume, count(distinct tx_id) as swap_count,
'trader' as type_trade, date_trunc('day', block_timestamp) as dt
from terra.swaps
where swap_pair like '%LUNA%'
and block_timestamp > CURRENT_DATE - 30
and trader != 'terra10kjnhhsgm4jfakr85673and3aw2y4a03598e0m'
group by 3,4
union
select sum(offer_amount_usd) as total_volume, count(distinct tx_id) as swap_count,
'community pool' as type_trade, date_trunc('day', block_timestamp) as dt
from terra.swaps
where swap_pair like '%LUNA%'
and block_timestamp > CURRENT_DATE - 30
and trader = 'terra10kjnhhsgm4jfakr85673and3aw2y4a03598e0m'
group by 3,4
)
select total_volume, swap_count, type_trade,
total_ust_sup, dt
from luna_swap_volume lu
join ust_supply ust on
lu.dt = ust.date
Run a query to Download Data