Eman-RazWhales activity
    Updated 2022-10-07
    with table1 as (select address, balance_usd
    from terra.classic.dim_daily_balances
    where balance_usd is not null
    and date='2022-06-18'
    order by 2 DESC
    limit 41),
    table2 as (with tab1 as (select tx:body:messages[0]:from_address as sender, sum(tx:body:messages[0]:amount[0]:amount)/pow(10,6) as luna_sent
    from terra.core.fact_transactions
    where tx:body:messages[0]:amount[0]:denom='uluna'
    and TX_SUCCEEDED='TRUE'
    and (block_timestamp::date='2022-09-08' OR block_timestamp::date='2022-09-09'
    OR block_timestamp::date='2022-05-28' OR block_timestamp::date='2022-05-30'
    OR block_timestamp::date='2022-05-31'
    OR block_timestamp::date='2022-09-10'
    OR block_timestamp::date='2022-09-14')
    group by 1
    order by 2 desc),
    tab2 as (select tx:body:messages[0]:to_address as receiver, sum(tx:body:messages[0]:amount[0]:amount)/pow(10,6) as luna_received
    from terra.core.fact_transactions
    where tx:body:messages[0]:amount[0]:denom='uluna'
    and TX_SUCCEEDED='TRUE'
    and
    ( block_timestamp::date='2022-09-08'
    OR block_timestamp::date='2022-09-09'
    OR block_timestamp::date='2022-05-28'
    OR block_timestamp::date='2022-05-30'
    OR block_timestamp::date='2022-05-31')
    group by 1
    order by 2 desc)
    select sender as address_, luna_received, luna_sent
    from tab1 left join tab2 on tab1.sender=tab2.receiver
    where luna_received is not null and luna_sent is not null)
    select address, luna_received, luna_sent
    from table1 left join table2 on table1.address=table2.address_
    where luna_sent is not null

    Run a query to Download Data