rezarwzvolume and trades in past x days by pair trade
    Updated 23 hours ago
    with all_trades as (
    select
    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
    blast.core.ez_decoded_event_logs lo
    left join blast.core.ez_token_transfers tr1 on lo.tx_hash = tr1.tx_hash
    left join blast.core.ez_token_transfers tr2 on tr1.tx_hash = tr2.tx_hash
    where
    lo.contract_address = '0xb1a49c54192ea59b233200ea38ab56650dfb448c'
    and lo.event_name = 'OrderComplete'
    and tr1.from_Address = tr1.origin_from_address
    and tr1.to_Address = '0xb1a49c54192ea59b233200ea38ab56650dfb448c'
    and tr2.from_Address = '0xb1a49c54192ea59b233200ea38ab56650dfb448c'
    and tr2.to_Address = tr2.origin_from_address
    AND lo.block_timestamp >= DATEADD(day, -{{past_x_days}}, CURRENT_DATE)
    )
    SELECT
    date_trunc('day', block_timestamp) as date,
    Pairs_trade,
    sum(volume_usd) as "Volume(USD)",
    sum(sum(volume_usd)) over(
    partition by Pairs_trade
    Last run: about 23 hours agoAuto-refreshes every 24 hours
    DATE
    PAIRS_TRADE
    Volume(USD)
    Total Volume(USD)
    # of Trades
    # of Total Trades
    1
    2025-04-01 00:00:00.000BLAST-WETH12.66211577112.66211577111
    1
    72B
    59s