adriaparcerisasThorchain: Additional Swaps Required to Offset Emissions 2
Updated 2024-12-19
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
›
⌄
with
fees as (
SELECT
trunc(block_timestamp,'month') as months,
sum(liq_fee_rune) as fees,
count(distinct tx_id) as swaps,
sum(from_amount) as volume
from thorchain.defi.fact_swaps
group by 1
),
rewards as (
SELECT
trunc(day,'month') as months,
sum(block_rewards) as block_rewards
from thorchain.defi.fact_block_rewards
group by 1
),
final as (
SELECT
x.months,
block_rewards,
sum(block_rewards) over (order by x.months) as total_block_rewards,
fees,
sum(fees) over (order by x.months) as total_fees,
block_rewards/fees as reward_fees_ratio,
avg(reward_fees_ratio) over (order by x.months) as avg_reward_fees_ratio,
swaps,
swaps*avg_reward_fees_ratio as swaps_required
from fees x
join rewards y on x.months=y.months
order by 1 asc
)
SELECT
* from final where months='2024-11-01'
QueryRunArchived: QueryRun has been archived