Query editor
with sol_price as(select date_trunc('day', minute) as block_date, avg(price) as sol_pricefrom prices.usdwhere minute > timestamp '2024-03-01'and contract_address = 0x069b8857feab8184fb687f634618c035dac439dc1aeb3b5598a0f00000000001group by 1), usdt_fee as(selectdate_trunc('month',block_time) as time, sum(amount/1e6) as total_usdt_feefrom tokens_solana.transferswhere to_token_account = 'G9DxEfeTSG77uGKt32sTXQWHodGpbZEe4fAyeTxAUam9'and token_mint_address = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'and block_time between timestamp '{{start_date}}' and timestamp '{{end_date}}'group by 1), usdc_fee as(selectdate_trunc('month',block_time) as time, sum(amount/1e6) as total_usdc_feefrom tokens_solana.transferswhere to_token_account = 'DB4KNmfTDs8XBjsqTfP2orBz297e5Uf7KtiGw39jRKPW'and token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'and block_time between timestamp '{{start_date}}' and timestamp '{{end_date}}'group by 1), sol_fee as(selectdate_trunc('month',block_time) as time, sum(amount * sol_price / 1e9) as total_solana_feefrom tokens_solana.transfersjoin sol_price using (block_date)where to_token_account = 'EcDs7cZxDHnGtjBuL6E1QC5smfPaBVWbdTShCXyor6H3'and token_mint_address = 'So11111111111111111111111111111111111111112'and block_time between timestamp '{{start_date}}' and timestamp '{{end_date}}'group by 1), final as(selecttime, total_usdt_fee, total_usdc_fee, total_solana_fee, total_usdt_fee + total_usdc_fee + total_solana_fee as total_feefrom usdt_feejoin usdc_fee using (time)join sol_fee using (time))selecttime, total_fee, total_usdt_fee, total_usdc_fee, total_solana_fee, sum(total_usdt_fee) over(order by time asc) as total_usdt_fee_cul, sum(total_usdc_fee) over(order by time asc) as total_usdc_fee_cul, sum(total_solana_fee) over(order by time asc) as total_solana_fee_cul, sum(total_fee) over(order by time asc) as total_fee_culfrom finalgroup by 1,2,3,4,5