alessio9567USDC total market cap over time - weekly
    Updated 2022-10-07
    WITH outflow AS (
    SELECT date_trunc('week',block_timestamp)::date as outflow_date
    ,sum(amount) as outflow_amount
    ,sum(outflow_amount) OVER ( ORDER BY outflow_date ) AS cum_outflow_amount
    FROM solana.core.fact_transfers t JOIN solana.core.dim_labels l
    ON t.tx_to = l.address
    WHERE mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' -- USDC token address
    GROUP BY 1
    )
    ,inflow AS (
    SELECT date_trunc('week',block_timestamp)::date as inflow_date
    ,sum(amount) as inflow_amount
    ,sum(inflow_amount) OVER ( ORDER BY inflow_date ) AS cum_inflow_amount
    FROM solana.core.fact_transfers t JOIN solana.core.dim_labels l
    ON t.tx_from = l.address
    WHERE mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' -- USDC token address
    GROUP BY 1
    )
    SELECT inflow_amount
    ,outflow_amount
    ,inflow_amount - outflow_amount AS marketcap
    ,cum_inflow_amount - cum_outflow_amount AS cum_marketcap
    ,inflow_date
    FROM inflow INNER JOIN outflow
    ON inflow_date = outflow_date
    Run a query to Download Data