rwa-analysis
Installation
SKILL.md
RWA Analysis
RWA questions look like simple aggregations ("what's the AUM of X," "how many holders does Y have") but the naive query is usually wrong in a specific, recurring way. Read this before writing SQL for an RWA question — it's cheaper than debugging a 30x-inflated number after the fact.
Aggregation: snapshot, don't sum
AUM, market cap, and supply are stock quantities (a balance at a point in time), not flow quantities. Summing a daily-snapshot table across a date range compounds the same balance over and over.
- Take the latest row per grouping key (
QUALIFY ROW_NUMBER() OVER (PARTITION BY ... ORDER BY date DESC) = 1, orMAX(date)per group), neverSUM(market_cap_usd)/SUM(supply)across days. - This mistake is easy to miss because the wrong number is still plausible-looking — one real case reported "$220B" AUM that was actually $7.2B, a ~30x inflation from summing ~30 days of the same snapshot.