Updated 2024-10-07
    with mints as (
    select
    block_timestamp::date as date
    ,mint
    ,sum(balance-pre_balance) as diff
    ,count(*) as num
    from solana.core.fact_token_balances
    where 1=1
    and owner = '45ruCyfdRkWpRNGEqWzjCiXRHkZs8WXCLQ67Pnpye7Hp'
    -- and tx_id = '3eufenCiSaWt1XjxyvjSgh7YeEtFNR7mAEXx9yXm7szp8rythGAmpTviSBC8XF7msEDoSE1EbeTLYeJg5uxtnBzW'
    and balance > pre_balance
    -- and block_timestamp between '2024-08-01' and '2024-08-02'
    -- and block_timestamp between '2024-08-01' and '2024-08-08'
    and block_timestamp > '2024-01-01'
    -- and mint in ('So11111111111111111111111111111111111111112', 'So11111111111111111111111111111111111111111')
    group by block_timestamp::date, mint
    )
    , prices as (
    select
    a.*
    , diff*price as usd
    , b.price, b.symbol, b.name
    from mints a
    left join solana.price.ez_prices_hourly b
    on a.mint = b.token_address
    where 1=1
    and hour = '2024-08-08 12:00:00.000'
    )
    -- select * from prices

    select
    date
    ,date_trunc('week', date) as week
    ,sum(usd)
    ,sum(num)
    from prices
    QueryRunArchived: QueryRun has been archived