PawlusUNI Token - Deposits and Withdrawals by Exchange
    Updated 2021-05-11
    WITH inflows as (
    SELECT
    date_trunc('day',block_timestamp) as date,
    to_label as exchange,
    sum(amount_usd) as deposits_usd
    FROM ethereum.udm_events
    WHERE
    block_timestamp >= getdate() - interval '9 days'
    and
    ((
    to_label_type = 'cex'
    and (from_label_type <> 'cex' OR from_label_type IS NULL)
    ) OR (
    to_label_type = 'dex'
    and (from_label_type <> 'dex' OR from_label_type IS NULL)
    ))
    and contract_address = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'
    GROUP BY 1,2
    ),

    outflows as (
    SELECT
    date_trunc('day',block_timestamp) as date,
    from_label as exchange,
    sum(amount_usd) as withdrawals_usd
    FROM ethereum.udm_events
    WHERE
    block_timestamp >= getdate() - interval '9 days'
    and
    ((
    from_label_type = 'cex'
    and (to_label_type <> 'cex' OR to_label_type IS NULL)
    ) OR (
    from_label_type = 'dex'
    and (to_label_type <> 'dex' OR to_label_type IS NULL)
    ))
    Run a query to Download Data