Query editor
WITH aero_lp_holders AS (SELECT DISTINCTto AS holder_address,COUNT(DISTINCT tokenId) AS position_count,MIN(evt_block_time) AS first_lp_time,ARRAY_AGG(DISTINCT tokenId ORDER BY tokenId) AS position_idsFROM erc721_base.evt_TransferWHERE contract_address = 0xa990C6a764b73BF43cee5Bb40339c3322FB9D55FAND to != 0x0000000000000000000000000000000000000000AND evt_block_time >= TIMESTAMP '2024-01-01'AND to NOT IN (SELECT DISTINCT "from"FROM erc721_base.evt_TransferWHERE contract_address = 0xa990C6a764b73BF43cee5Bb40339c3322FB9D55FAND "from" != 0x0000000000000000000000000000000000000000)GROUP BY to),trader_stats AS (SELECTwm.trader,wm.total_trades,wm.total_volume_usd,wm.trades_per_hour,wm.net_position,wm.unique_pairs_traded,wm.active_days,wm.first_trade_time,wm.last_trade_timeFROM query_6455994 wm),self_dealing_analysis AS (SELECTts.trader,lp.position_count,lp.first_lp_time,lp.position_ids,ts.total_trades,ts.total_volume_usd,ts.trades_per_hour,ts.active_days,ts.unique_pairs_traded,ts.net_position,ts.first_trade_time,ts.last_trade_time,CASEWHEN ts.first_trade_time > lp.first_lp_timeTHEN 'Started trading AFTER acquiring LP position'WHEN ts.first_trade_time < lp.first_lp_timeTHEN 'Had LP position while actively trading'ELSE 'Unknown timing'END AS timing_evidence,DATE_DIFF('day', lp.first_lp_time, ts.first_trade_time) AS days_between_lp_and_trading,