BlazeArbitrum Swaps
    Updated 2024-12-19
    -- forked from BSC Swaps @ https://flipsidecrypto.xyz/edit/queries/de0a692f-a2a5-4f33-b4e7-639f0e04d9b9

    -- forked from Eth swaps @ https://flipsidecrypto.xyz/edit/queries/566b64cd-6c50-41ca-a883-3830ac225b10

    select
    week,
    token,
    symbol,
    t1.amount_in as amount_in,
    -t2.amount_out as amount_out,
    case
    when t1.amount_in is null then -t2.amount_out
    when t2.amount_out is null then t1.amount_in
    else t1.amount_in - t2.amount_out
    end as net_amount_in,
    case
    when t1.amount_in_usd is null then -t2.amount_out_usd
    when t2.amount_out_usd is null then t1.amount_in_usd
    else t1.amount_in_usd - t2.amount_out_usd
    end as net_amount_in_usd,
    case
    when t1.amount_in is null then t2.amount_out
    when t2.amount_out is null then t1.amount_in
    else t1.amount_in + t2.amount_out
    end as net_vol,
    case
    when t1.amount_in_usd is null then t2.amount_out_usd
    when t2.amount_out_usd is null then t1.amount_in_usd
    else t1.amount_in_usd + t2.amount_out_usd
    end as net_vol_usd
    from
    (
    SELECT
    date_trunc('week',BLOCK_TIMESTAMP) as week,
    TOKEN_IN as token,
    -- SYMBOL_IN as symbol,
    QueryRunArchived: QueryRun has been archived