boomer77thornode buy $RUNE
    Updated 2022-02-10
    with bond_plus as (select from_address, sum(asset_amount) as total_bond, bond_type
    from thorchain.bond_actions
    where bond_type in ('bond_paid')
    group by 1,3),

    bond_minus as (select from_address, sum(asset_amount) as remove_bond, bond_type
    from thorchain.bond_actions
    where bond_type in ('bond_returned')
    group by 1,3),

    current_node as (select a.from_address, (a.total_bond-b.remove_bond) as current_bond
    from bond_plus a
    join bond_minus b on a.from_address = b.from_address
    order by current_bond desc),

    addresses as (select from_address, current_bond
    from current_node
    where current_bond > 10),

    sell_swap as (select date_trunc('week', block_timestamp) as dt, 'before' as emission_change, sum(amount_e8/1e8) as buy_volume
    from thorchain.transfer_events
    where asset = 'THOR.RUNE' and to_address in (select from_address from addresses)
    and block_id < '3704556'
    group by 1,2
    union
    select date_trunc('week', block_timestamp) as dt, 'after' as emission_change, sum(amount_e8/1e8) as buy_volume
    from thorchain.transfer_events
    where asset = 'THOR.RUNE' and to_address in (select from_address from addresses)
    and block_id >= '3704556'
    group by 1,2)

    select * from sell_swap
    Run a query to Download Data