Query editor
-- ============================================================================-- QUERY 2: 💰 CASHCAT Early-Buyer PnL Tracker-- Every wallet that bought CASHCAT before 2026-07-08, with full PnL:-- cost basis, realized PnL (proportional cost basis on the sold part),-- unrealized PnL (remaining bag marked at 24h VWAP), and the multiple.-- No cohort gates here — the whole early-buyer population, sorted by multiple,-- so the "$312 → $84k" rows surface at the top.-- ============================================================================with cashcat_buys as (selecttx_from, min(block_time) as first_buy_time, count(*) as buy_count, sum(amount_usd) as cost_usd, sum(token_bought_amount) as tokens_boughtfrom dex.tradeswhere blockchain = 'robinhood'and token_bought_address = 0x020bfc650a365f8bb26819deaabf3e21291018b4and block_time < timestamp '2026-07-08 00:00:00' -- early buys onlyand amount_usd > 0group by 1), cashcat_sells as (-- lifetime sells (not date-capped) for realized PnLselecttx_from, min(block_time) as first_sell_time, count(*) as sell_count, sum(amount_usd) as proceeds_usd, sum(token_sold_amount) as tokens_soldfrom dex.tradeswhere blockchain = 'robinhood'and token_sold_address = 0x020bfc650a365f8bb26819deaabf3e21291018b4and amount_usd > 0group by 1), current_price as (-- 24h VWAP with 7d fallback, same as Query 1selectcoalesce(sum(case when block_time >= now() - interval '24' hour then amount_usd end)/ nullif(sum(case when block_time >= now() - interval '24' hour then token_bought_amount end), 0),sum(amount_usd) / nullif(sum(token_bought_amount), 0)) as price_usdfrom dex.tradeswhere blockchain = 'robinhood'and token_bought_address = 0x020bfc650a365f8bb26819deaabf3e21291018b4and block_time >= now() - interval '7' dayand amount_usd > 0), pnl as (selectb.tx_from, b.first_buy_time, s.first_sell_time