Commodities · gold tokens compared

Query by @astrolabe-rwa, updated 2026-10-04. #rwa #commodities #gold

Example query

SQL (ClickHouse)

SELECT block_date AS day, symbol,
       round(round(if(sumIf(usd_amount, venue = 'Raydium CLMM') >= 100, quantileExactWeightedIf(0.5)(price_usd, toUInt64(usd_amount * 100), venue = 'Raydium CLMM'), quantileExactWeighted(0.5)(price_usd, toUInt64(usd_amount * 100))), 2) / first_value(round(if(sumIf(usd_amount, venue = 'Raydium CLMM') >= 100, quantileExactWeightedIf(0.5)(price_usd, toUInt64(usd_amount * 100), venue = 'Raydium CLMM'), quantileExactWeighted(0.5)(price_usd, toUInt64(usd_amount * 100))), 2)) OVER (PARTITION BY symbol ORDER BY block_date) * 100, 2) AS price_index
FROM ref.rwa_trades
WHERE block_date >= today() - {{days}} AND symbol IN ('GLDx', 'GOLD')
GROUP BY day, symbol
ORDER BY day

Charts: Gold tokens, price index (first day = 100): GLDx is a share of the GLD ETF, GOLD is one ounce.

Result

daysymbolprice_index
2026-11-09GLDx100.0
2026-11-09GOLD100.0
2026-11-10GLDx98.69
2026-11-10GOLD99.24
2026-11-11GLDx98.17
2026-11-11GOLD98.03
2026-11-12GLDx95.74
2026-11-12GOLD96.55
2026-11-13GLDx94.55
2026-11-13GOLD95.19
2026-11-14GLDx92.62
2026-11-14GOLD94.41
2026-11-15GLDx93.11
2026-11-15GOLD94.42
2026-11-16GLDx93.89
2026-11-16GOLD94.89
2026-11-17GLDx93.93
2026-11-17GOLD94.94
2026-11-18GLDx91.66
2026-11-18GOLD93.47
2026-11-19GLDx90.05
2026-11-19GOLD90.76
2026-11-20GLDx86.07
2026-11-20GOLD87.57
2026-11-21GLDx86.35
2026-11-21GOLD86.95
2026-11-22GLDx86.32
2026-11-22GOLD87.21

28 rows. Computed 2026-11-23T11:23:16Z.