hmxinternTotal trading vol
    Updated 2024-09-16
    with trades as (
    select
    BLOCK_TIMESTAMP, DECODED_LOG['primaryAccount'] as account,
    case
    when EVENT_NAME = 'LogIncreasePosition' then abs(DECODED_LOG['increasedSize'])
    when EVENT_NAME = 'LogDecreasePosition' then abs(DECODED_LOG['decreasedSize'])
    end as vol
    from blast.core.fact_decoded_event_logs
    where CONTRACT_ADDRESS = lower('0x0a8D9c0A4a039dDe3Cb825fF4c2f063f8B54313A')
    and EVENT_NAME in ('LogIncreasePosition', 'LogDecreasePosition')
    ),
    liquidate as (
    select
    BLOCK_TIMESTAMP, DECODED_LOG['account'] as account,
    abs(DECODED_LOG['size']) as vol
    from blast.core.fact_decoded_event_logs
    where CONTRACT_ADDRESS = lower('0x963Cbe4cFcDC58795869be74b80A328b022DE00C')
    and EVENT_NAME = 'LogLiquidationPosition'
    )


    select sum(vol) / 1e30 as vol
    from (
    select * from trades
    union all
    select * from liquidate
    )
    where block_timestamp >= current_timestamp() - interval '1 day'
    QueryRunArchived: QueryRun has been archived