kiacryptowhales prefer to sell or buy?
    Updated 2022-10-08
    with whales as (
    select distinct tx:body:messages[0]:from_address as address
    from terra.core.fact_transactions
    where tx:body:messages[0]:amount[0]:amount/1e6 > 500000
    ),
    whale_sells as (
    select
    count(distinct tx_id) as sell_count_by_whales,
    sum(tx:body:messages[0]:amount[0]:amount/1e6) as sell_volume_by_whales
    from terra.core.fact_transactions
    where tx:body:messages[0]:from_address in (select address from whales) and tx:body:messages[0]:amount[0]:denom = 'uluna' and tx_succeeded = TRUE
    ),
    whale_buys as (
    select
    count(distinct tx_id) as buy_count_by_whales,
    sum(tx:body:messages[0]:amount[0]:amount/1e6) as buy_volume_by_whales
    from terra.core.fact_transactions
    where tx:body:messages[0]:to_address in (select address from whales) and tx:body:messages[0]:amount[0]:denom = 'uluna' and tx_succeeded = TRUE
    )
    select
    sell_volume_by_whales,
    sell_count_by_whales,
    'sell' as type
    from whale_sells

    union all

    select
    buy_volume_by_whales,
    buy_count_by_whales,
    'buy' as type
    from whale_buys
    Run a query to Download Data