hmxinternUnrealized PnL
    Updated 2024-05-19
    WITH config as (
    select
    timestamp '2024-04-25 00:01' as start_time,
    timestamp '2024-05-08 23:59' as end_time
    ),
    account_connection as (
    select
    distinct *
    from
    (
    select
    DECODED_LOG ['primaryAccount'] as account,
    DECODED_LOG ['subAccount'] as subAccount
    from
    blast.core.fact_decoded_event_logs
    where
    CONTRACT_ADDRESS = lower('0x0a8D9c0A4a039dDe3Cb825fF4c2f063f8B54313A')
    and EVENT_NAME = 'LogIncreasePosition'
    )
    ),
    first_appearance_in_comp as (
    select
    distinct primaryAccount,
    subAccountId,
    marketIndex,
    first_value(evt_block_time) over (
    partition by primaryAccount,
    subAccountId,
    marketIndex
    order by
    evt_block_time asc
    ) as first_valid_open,
    first_value(evt_tx_hash) over (
    partition by primaryAccount,
    subAccountId,
    marketIndex
    QueryRunArchived: QueryRun has been archived