LTirrell2022-03-04_terra_LFG_in-out
    Updated 2022-04-08
    with outbounds as (
    select
    date_trunc('day', block_timestamp) as datetime,
    recipient as address,
    recipient_label as address_label,
    recipient_address_name as address_name,
    'outbound' as direction,
    currency,
    sum(amount) * -1 as amount,
    sum(amount_usd) * -1 as amount_usd
    -- (
    -- select
    -- avg(price_usd)
    -- from
    -- terra.oracle_prices
    -- where
    -- currency = 'uluna'
    -- and block_timestamp :: date = CURRENT_DATE
    -- ) as luna_price,
    -- case
    -- when currency = 'LUNA' then luna_price * sum(amount) * -1
    -- else sum(amount_usd) * -1
    -- end as amount_usd_normalized
    FROM
    terra.transfer_events
    where
    block_timestamp > current_date - 100
    and sender = 'terra1gr0xesnseevzt3h4nxr64sh5gk4dwrwgszx3nw'
    and abs(amount_usd) > 1000
    group by
    1,
    2,
    3,
    4,
    5,
    6
    Run a query to Download Data