boomer77thorchain rewards
    Updated 2021-10-24
    with rewards as (select *
    from thorchain.block_rewards
    order by day desc
    limit 30),

    prices as (select date_trunc('day', block_timestamp) as dt, avg(rune_usd) as RUNE_price
    from thorchain.prices
    where block_timestamp >= CURRENT_DATE - 30
    group by 1)

    select *, (a.bonding_earnings * b.rune_price) as bonding_earnings_USD, (a.liquidity_earnings * b.rune_price) as LP_earnings_USD
    from rewards a
    join prices b on a.day = b.dt
    Run a query to Download Data