theericstoneai testing
    Updated 2025-01-17
    WITH token_activity AS (
    -- Get swap activity
    SELECT
    DATE_TRUNC('day', block_timestamp) as date,
    COUNT(DISTINCT tx_id) as swap_count,
    COUNT(DISTINCT swapper) as unique_traders,
    SUM(swap_from_amount_usd) as total_volume_usd
    FROM solana.defi.ez_dex_swaps
    WHERE (swap_from_mint = '56BdVAwKSKrasuUnC2F3HwLbo5ntLFKWb15B3daKpump'
    OR swap_to_mint = '56BdVAwKSKrasuUnC2F3HwLbo5ntLFKWb15B3daKpump')
    AND block_timestamp >= CURRENT_DATE - 30
    GROUP BY 1
    ),
    token_transfers AS (
    -- Get transfer activity
    SELECT
    DATE_TRUNC('day', block_timestamp) as date,
    COUNT(DISTINCT tx_id) as transfer_count,
    COUNT(DISTINCT tx_from) as unique_senders,
    COUNT(DISTINCT tx_to) as unique_receivers
    FROM solana.core.fact_transfers
    WHERE mint = '56BdVAwKSKrasuUnC2F3HwLbo5ntLFKWb15B3daKpump'
    AND block_timestamp >= CURRENT_DATE - 30
    GROUP BY 1
    ),
    price_data AS (
    -- Get price information
    SELECT
    DATE_TRUNC('day', hour) as date,
    AVG(price) as avg_daily_price,
    MAX(price) as max_price,
    MIN(price) as min_price
    FROM solana.price.ez_prices_hourly
    WHERE token_address = '56BdVAwKSKrasuUnC2F3HwLbo5ntLFKWb15B3daKpump'
    AND hour >= CURRENT_DATE - 30
    GROUP BY 1
    QueryRunArchived: QueryRun has been archived