h4wkcurrent value of acquired bonk
    Updated 1 day ago
    -- forked from base @ https://flipsidecrypto.xyz/studio/queries/b3c76ba9-e256-42ee-af38-467881c899e8

    with bonk_price as (
    select hour,
    symbol,
    token_address,
    price
    from solana.price.ez_prices_hourly
    where token_address = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    )
    , latest_bonk_price as (
    select price as bonk_latest_price
    from solana.price.ez_prices_hourly
    where token_address = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    qualify row_number() over (order by hour desc) = 1
    )
    , latest_token_price as (
    select token_address,
    price as token_latest_price
    from solana.price.ez_prices_hourly
    qualify row_number() over (partition by token_address order by hour desc) = 1
    )
    , base as (
    select a.block_timestamp,
    a.tx_id,
    swapper as user_address,
    swap_from_mint,
    swap_from_amount,
    c.symbol as swap_from_symbol,
    swap_to_amount as bonk_amount,
    swap_to_amount * price as volume_bonk_usd,
    amount * 3 as fee_amount, -- Fees split into 3 addresses equally, so we just multiply by 3
    amount * 3 * price as fee_amount_usd,
    0.00203928 as rent_returned,
    bonk_latest_price,
    bonk_amount * bonk_latest_price as current_bonk_vol,
    Last run: 1 day ago
    TYPE
    TOKEN_COUNT
    1
    In BONK Loss166047
    2
    In BONK Profit8959
    2
    49B
    290s