boomer77Staking vs Rewards ROI - dunno
Updated 2021-11-24
99
1
2
3
4
5
6
7
8
9
10
11
12
13
›
⌄
with stake as (select date, sum(balance) as LUNA_staked_usd
from terra.daily_balances
where currency = 'LUNA' and date >= CURRENT_DATE - 89 and balance_type = 'staked' and address != 'terra10kjnhhsgm4jfakr85673and3aw2y4a03598e0m'
group by 1),
rewards as (select date_trunc('day', block_timestamp) as dt, sum(event_amount_usd) as rewards_usd
from terra.reward
where block_timestamp >= CURRENT_DATE - 89 and action = 'withdraw_delegator_rewards'
group by 1)
select a.date, a.luna_staked_usd, b.rewards_usd, (b.rewards_usd/a.luna_staked_usd)*100 as ROI_APY
from stake a
join rewards b on a.date = b.dt
Run a query to Download Data