binhachonActivity after re-enabling pools - #3
    Updated 2022-06-04
    with user_addresses as (
    select
    from_address as address,
    case when from_asset = 'THOR.RUNE' then 'Sell RUNE' else 'Buy RUNE' end as type,
    sum(from_amount_usd + to_amount_usd)/2 as volume
    from flipside_prod_db.thorchain.swaps
    where date_trunc('minute', block_timestamp) >= '2021-11-18 18:47:00.000'
    and date_trunc('minute', block_timestamp) <= '2021-11-18 19:00:00.000'
    group by 1, 2
    union all
    select
    native_to_address,
    case when from_asset = 'THOR.RUNE' then 'Sell RUNE' else 'Buy RUNE' end as type,
    sum(from_amount_usd + to_amount_usd)/2 as volume
    from flipside_prod_db.thorchain.swaps
    where date_trunc('minute', block_timestamp) >= '2021-11-18 18:47:00.000'
    and date_trunc('minute', block_timestamp) <= '2021-11-18 19:00:00.000'
    group by 1, 2
    ),
    users_stats as (
    select
    from_address as address
    from flipside_prod_db.thorchain.swaps
    where block_timestamp::date >= '2021-11-18'
    and block_timestamp::date <= '2021-12-01'
    union all
    select
    native_to_address
    from flipside_prod_db.thorchain.swaps
    where block_timestamp::date >= '2021-11-18'
    and block_timestamp::date <= '2021-12-01'
    ),
    swap_histogram as (
    select
    case when number_of_swaps < 100 then number_of_swaps else 100 end as number_of_swaps,
    'Overall distribution' as symbol,
    Run a query to Download Data