Query editor
-- 2026-11-21: source switched from matview dune.ondo_team.result_ondo_assets_price_history to the plain query_6750841-- (ondo_assets_price_history). The matview and its daily schedule were deleted (~0.3k credits/month);-- query_6750841 now runs inline (GM API http_get for all assets, ~10 credits). Logic unchanged.-- To go back: recreate the matview on 6750841 and swap query_6750841 back to dune.ondo_team.result_ondo_assets_price_history.with gm_px as (select symbol, max_by(price, day) price from query_6750841 where price is not null and day >= current_date - interval '14' day group by 1),t as (select 'ethereum' blockchain, a.address contract_address, p.price px from dune.ondo_team.result_ondo_assets a join gm_px p on p.symbol = a.symbol where a.symbol <> 'USDon' and a.address is not nullunion allselect 'bnb', a.address_bnb, p.price from dune.ondo_team.result_ondo_assets a join gm_px p on p.symbol = a.symbol where a.symbol <> 'USDon' and a.address_bnb is not null),b as (select 'ethereum' blockchain, address, token_address, balance_raw, updated_at from balances_ethereum.latest where token_address in (select contract_address from t where blockchain='ethereum') and balance_raw > 0union allselect 'bnb', address, token_address, balance_raw, updated_at from balances_bnb.latest where token_address in (select contract_address from t where blockchain='bnb') and balance_raw > 0),v as (select b.address, b.blockchain, cast(b.balance_raw as double)/1e18 * t.px usd, b.updated_atfrom b join t on t.blockchain=b.blockchain and t.contract_address=b.token_addresswhere b.address <> 0x0000000000000000000000000000000000000000),w as (select lower(cast(address as varchar)) wallet, sum(usd) gm_usd, array_join(array_agg(distinct blockchain), ',') chains from v group by 1)select w.*, (select count(*) from w) n_all, (select sum(gm_usd) from w) tvl_all, (select max(updated_at) from v) max_updfrom w where gm_usd >= 1000 order by gm_usd desc