MLDZMNdom4
    Updated 2023-08-15
    with t2 as (select
    RECORDED_HOUR::date as day,
    avg(close) as price_bonk
    from solana.core.fact_token_prices_hourly
    where SYMBOL ilike 'bonk'
    group by 1)

    select
    date_trunc('week',BLOCK_TIMESTAMP) as date,
    count(distinct tx_id)*69000000 as volume_bonk,
    count(distinct tx_id)*69000000*price_bonk as volume_usd,
    sum(volume_bonk) over (order by date) as total_bonk,
    sum(volume_usd) over (order by date) as total_USD
    from solana.core.fact_events s
    left join t2 on date_trunc('day',s.block_timestamp)=t2.day
    WHERE program_id = 'TLDHkysf5pCnKsVA4gXpNvmy7psXLPEu4LAdDJthT9S'
    and inner_instruction:instructions[0]:parsed:info:mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    AND inner_instruction:instructions[0]:parsed:type = 'burn'
    and BLOCK_TIMESTAMP>=current_date-{{Days_back}}
    group by 1,price_bonk
    order by 1
    Run a query to Download Data