blue226opos
    Updated 2023-01-24
    with token_average_price_usd as (select avg(price) as price , symbol , currency from osmosis.core.ez_prices
    group by symbol,currency)
    , tops as (select sum(amount/pow(10,DECIMAL) * price) as amount_USD , sender
    from osmosis.core.fact_transfers
    inner join token_average_price_usd on token_average_price_usd.currency=osmosis.core.fact_transfers.currency
    where DECIMAL is not null and amount/pow(10,DECIMAL) < 100000 and symbol='SCRT'
    group by sender
    order by amount_USD DESC
    limit 10)

    select sum(amount/pow(10,DECIMAL) * price) as amount_USD , sender , date_trunc('month', block_timestamp::date) as transfer_date
    from osmosis.core.fact_transfers
    inner join token_average_price_usd on token_average_price_usd.currency=osmosis.core.fact_transfers.currency
    where DECIMAL is not null and amount/pow(10,DECIMAL) < 100000 and symbol='SCRT' and sender in (select sender from tops)
    group by sender,transfer_date
    Run a query to Download Data