rezarwzVolume and trades in past x days copy
    Updated 2025-04-15
    -- forked from Volume and trades in past x days @ https://flipsidecrypto.xyz/studio/queries/ba87c676-8dff-46f6-adbb-525c00d38e57
    with all_trades as (
    select
    'Arbitrum' as blockchain,
    tr1.tx_hash,
    lo.block_timestamp,
    tr1.symbol as in_token,
    tr2.symbol as out_token,
    tr1.AMOUNT_USD as amount_in,
    tr2.AMOUNT_USD as amount_out,
    lo.decoded_log:taker as taker,
    CASE
    when amount_in is not null then amount_in
    else amount_out
    end as volume_usd,
    CASE
    WHEN in_token < out_token THEN in_token || '-' || out_token
    ELSE out_token || '-' || in_token
    END AS Pairs_trade
    from
    Arbitrum.core.ez_decoded_event_logs lo
    left join Arbitrum.core.ez_token_transfers tr1 on lo.tx_hash = tr1.tx_hash
    left join Arbitrum.core.ez_token_transfers tr2 on tr1.tx_hash = tr2.tx_hash
    where
    lo.contract_address = '0x109d9cdfa4ac534354873ef634ef63c235f93f61'
    and lo.event_name = 'OrderComplete'
    and tr1.from_Address = tr1.origin_from_address
    and tr1.to_Address in (
    '0x50793d97a0c905ea51c1c93f37fc73abe6d2ffcc',
    '0x109d9cdfa4ac534354873ef634ef63c235f93f61'
    )
    and tr2.from_Address in(
    '0x50793d97a0c905ea51c1c93f37fc73abe6d2ffcc',
    '0x109d9cdfa4ac534354873ef634ef63c235f93f61'
    )
    and tr2.to_Address = tr2.origin_from_address
    Last run: 14 days agoAuto-refreshes every 24 hours
    No Data to Display
    0
    2B
    15s