Query editor
with supply as (select time, contract_address, symbol, amountfrom dune."21co".result_stablecoin_total_supply_on_ethereum),price as (select date_trunc('day', minute) as day, contract_address, symbol, avg(price) as pricefrom prices.usdwhere minute >= date('2021-01-01') and contract_address in (select distinct contract_address from supply) and blockchain = 'ethereum'group by 1, 2, 3union allselect day, contract_address, symbol, pricefrom dune."21co".result_stablecoin_missing_price),custom_table as (select category, symbolfrom query_3808604 -- stablecoins overview tablewhere blockchain = 'ethereum'),summary as (select a.time, a.symbol, amount * price as market_capfrom supply aleft join price b on a.time = b.day and a.contract_address = b.contract_address),final as (select a.time, a.symbol, market_cap, b.categoryfrom summary ajoin custom_table b on a.symbol = b.symbol)select category, sum(market_cap) as total_market_capfrom finalwhere market_cap is not null and time >= now() - interval '24' hour -- aggregating data for the last 24 hoursgroup by categoryorder by total_market_cap desc