amir007-Q63RX1Osmosis - HODLers vs LPers vs Stakers - Osmo token HODLers (Over Month)
    Updated 2022-07-12
    with osmo_buy as
    (
    select date_trunc('month', block_timestamp::date) as date
    , sum(to_amount/1e6) as to_osmo
    from osmosis.core.fact_swaps
    where block_timestamp::date >= '2022-01-01'
    and to_currency = 'uosmo'
    group by 1
    ), osmo_sell as
    (
    select date_trunc('month', block_timestamp::date) as date
    , sum(from_amount/1e6) as from_osmo
    from osmosis.core.fact_swaps
    where block_timestamp::date >= '2022-01-01'
    and from_currency = 'uosmo'
    group by 1
    ), osmo_hodl as
    (
    select osmo_buy.date as date
    , to_osmo
    , from_osmo
    , to_osmo - from_osmo as sum_osmo_hodl
    from osmo_buy
    join osmo_sell on osmo_buy.date = osmo_sell.date
    )
    select date as "Date (Month)"
    , sum(to_osmo) over (order by date) as "buy osmo"
    , sum(from_osmo) over (order by date) as "sell osmo"
    , sum(sum_osmo_hodl) over (order by date) as "sum osmo HODL"
    from osmo_hodl
    order by 1

    Run a query to Download Data