SalehL-H-whales buying or selling?
    Updated 2022-10-07
    with lst_whales as (
    select top 10
    tx:body:messages[0]:to_address as wallet
    ,sum(fee) as fee_volume
    ,count(DISTINCT tx_id) as tx_count
    ,sum(tx:body:messages[0]:amount[0]:amount)/1e6 as luna_volume
    from terra.core.fact_transactions
    where FEE_DENOM='uluna'
    and TX_SUCCEEDED=true
    and tx:body:messages[0]:amount[0]:amount/1e6>0
    group by 1
    order by luna_volume desc
    )
    , lst_selling as (
    select top 10
    block_timestamp::date as date
    -- ,tx:body:messages[0]:to_address as wallet
    ,sum(fee) as fee_volume
    ,count(DISTINCT tx_id) as tx_count
    ,sum(tx:body:messages[0]:amount[0]:amount)/1e6 as luna_volume
    from terra.core.fact_transactions
    where FEE_DENOM='uluna'
    and TX_SUCCEEDED=true
    and tx:body:messages[0]:amount[0]:amount/1e6>0
    and tx:body:messages[0]:to_address in(select wallet from lst_whales)
    group by 1
    order by luna_volume desc
    )
    ,lst_buying as (
    select top 10
    block_timestamp::date as date
    -- ,tx:body:messages[0]:from_address as wallet
    ,sum(fee) as fee_volume
    ,count(DISTINCT tx_id) as tx_count
    ,sum(tx:body:messages[0]:amount[0]:amount)/1e6 as luna_volume
    from terra.core.fact_transactions
    Run a query to Download Data