SkynetTradingNETFLOWS per time frame
    Updated 2024-07-10
    WITH inflows AS (
    SELECT
    date_trunc('{{Time_Frame}}', ez_token_transfers.block_timestamp) AS date,
    dim_labels.label AS dim_label,
    dim_labels.label_type AS dim_label_type,
    SUM(ez_token_transfers.amount) AS total_inflow_amount,
    SUM(ez_token_transfers.amount_usd) AS total_inflow_amount_usd,
    COUNT(ez_token_transfers.tx_hash) AS total_inflow_transactions
    FROM
    ethereum.core.ez_token_transfers
    LEFT OUTER JOIN
    ethereum.core.dim_labels
    ON
    ez_token_transfers.to_address = dim_labels.address
    WHERE
    ez_token_transfers.CONTRACT_ADDRESS = '0x940a2db1b7008b6c776d4faaca729d6d4a4aa551'
    AND ez_token_transfers.block_timestamp BETWEEN '{{Start_Date}}' AND '{{End_Date}}'
    AND dim_labels.label_type = 'cex'
    GROUP BY
    date,
    dim_labels.label,
    dim_labels.label_type
    ),

    outflows AS (
    SELECT
    date_trunc('{{Time_Frame}}', ez_token_transfers.block_timestamp) AS date,
    dim_labels.label AS dim_label,
    dim_labels.label_type AS dim_label_type,
    SUM(ez_token_transfers.amount) AS total_outflow_amount,
    SUM(ez_token_transfers.amount_usd) AS total_outflow_amount_usd,
    COUNT(ez_token_transfers.tx_hash) AS total_outflow_transactions
    FROM
    ethereum.core.ez_token_transfers
    LEFT OUTER JOIN
    ethereum.core.dim_labels
    QueryRunArchived: QueryRun has been archived