Masi1
Updated 2022-10-04
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
›
⌄
with tb1 as ( select trunc(block_timestamp,'week') as weekly,
sum(FROM_AMOUNT_USD) as swap_volume_usd,
sum(FROM_AMOUNT_USD/rune_usd) as swap_volume_rune,
sum(LIQ_FEE_RUNE_USD) as fee_usd,
sum(LIQ_FEE_RUNE) as fee_rune,
median(rune_usd) as rune_prices
from flipside_prod_db.thorchain.swaps
group by 1),
tb2 as ( select trunc(day,'week') as weekly,
sum(BLOCK_REWARDS+EARNINGS) as emission_in_rune
from flipside_prod_db.thorchain.block_rewards
where BLOCK_REWARDS > 0
and EARNINGS > 0
group by 1)
select a.weekly,
swap_volume_usd,
swap_volume_rune,
swap_volume_rune,
fee_usd,
fee_rune,
emission_in_rune,
emission_in_rune*rune_prices as emission_usd
from tb1 a left outer join tb2 b
on a.weekly = b.weekly
where a.weekly >= CURRENT_DATE - 365
Run a query to Download Data