HosseinUntitled Query
    Updated 2022-12-08
    with prices as (
    select recorded_hour::date as day,
    avg(close) as price_usd
    from solana.core.fact_token_prices_hourly
    where symbol = 'SOL'
    group by 1
    )

    select
    'Raydium' "Platform",
    sum(fee / 1e9) "Total Fee (SOL)",
    avg(fee / 1e9) "Average Fee (SOL)",
    median(fee / 1e9) "Median Fee (SOL)",
    sum((fee / 1e9) * 1) "Total Fee (USD)",
    avg((fee / 1e9) * 1) "Average Fee (USD)",
    median((fee / 1e9) * 1) "Median Fee (USD)"
    from solana.core.fact_swaps a
    join solana.core.fact_transactions b
    using(tx_id)
    --join prices
    -- on day = a.block_timestamp::date
    where swap_program ilike 'raydium%'
    and a.block_timestamp >= current_date - interval '1 day'
    group by 1
    Run a query to Download Data