Updated 2022-12-10
    with
    whales_movements as (
    SELECT
    block_timestamp,
    TX:body:messages[0]:from_address as seller,
    TX:body:messages[0]:to_address as buyer,
    TX:body:messages[0]:amount[0]:amount/pow(10,6) as amount,
    tx_id
    from terra.core.fact_transactions
    where tx:body:messages[0]:amount[0]:denom = 'uluna' and block_timestamp > '2022-01-01' and tx_succeeded = true
    and amount >=1e4
    )
    SELECT
    date(block_timestamp) as date,
    count(distinct tx_id) as txs,
    count(distinct seller) as whales_selling,
    whales_selling*(-1) as whales_sellings,
    count(distinct buyer) as whales_buying,
    whales_buying-whales_selling as net_whales_behavior,
    sum(amount) as volume_moved
    FROM whales_movements
    group by 1
    order by 1 asc
    Run a query to Download Data