boomer77thor buy pressure
    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', 'bond_reward')
    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, CASE
    when current_bond > 1000000 then '>1M_RUNE_OWNED'
    else 'less_than_1M' end as bond_balance
    from current_node
    where current_bond > 0)

    select bond_balance, count(distinct from_Address) as counts
    from addresses
    group by 1
    Run a query to Download Data