shadilthorchain Net Bonding Flow
    Updated 2022-05-05
    with added as (
    SELECT date_trunc('month', block_timestamp) as date, sum(asset_usd) as total
    from thorchain.bond_actions
    where bond_type = 'bond_paid' -- means they are adding
    GROUP by date
    ),
    removed as (
    SELECT date_trunc('month', block_timestamp) as date, sum(asset_usd) * -1 as total
    from thorchain.bond_actions
    where bond_type = 'bond_returned' -- means they are removing
    GROUP by date
    )

    SELECT * FROM added
    UNION
    SELECT * FROM removed

    Run a query to Download Data