SpiltadavidStable coin marketcap over inflow date.
    Updated 2022-10-08
    with
    USDC_outflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as USDC_outflow_date,sum(amount) as USDC_outflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_TO = l.address and mint ='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' group by 1), --USDC
    USDT_outflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as USDT_outflow_date,sum(amount) as USDT_outflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_TO = l.address and mint ='Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB' group by 1), --USDT
    UST_outflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as UST_outflow_date,sum(amount) as UST_outflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_TO = l.address and mint ='9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i' group by 1), --UST
    USDH_outflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as USDH_outflow_date,sum(amount) as USDH_outflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_TO = l.address and mint ='USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX' group by 1), --USDH
    DAI_outflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as DAI_outflow_date,sum(amount) as DAI_outflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_TO = l.address and mint ='Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS' group by 1), --DAI
    USDC_inflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as USDC_inflow_date,sum(amount) as USDC_inflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_FROM = l.address and mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' group by 1), --USDC
    USDT_inflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as USDT_inflow_date,sum(amount) as USDT_inflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_FROM = l.address and mint='Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB' group by 1), --USDT
    UST_inflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as UST_inflow_date,sum(amount) as UST_inflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_FROM = l.address and mint='9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i' group by 1), --UST
    USDH_inflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as USDH_inflow_date,sum(amount) as USDH_inflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_FROM = l.address and mint='USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX' group by 1), --USDH
    DAI_inflow as (select date_trunc(week,BLOCK_TIMESTAMP)::date as DAI_inflow_date,sum(amount) as DAI_inflow_amount from solana.core.fact_transfers t,solana.core.dim_labels l
    where
    t.TX_FROM = l.address and mint='Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS' group by 1) --DAI
    select
    'USDC' as stablecoins ,USDC_inflow_amount - USDC_outflow_amount as stablecoins_marketcap ,
    USDC_inflow_date from USDC_inflow inner join USDC_outflow on USDC_inflow_date=USDC_outflow_date
    UNION
    select
    Run a query to Download Data