Query editor
-- Spectra - Yields -> dune.spectra_yields-- PT and LP yields in one table, before maturity. yield_type:-- 'pt' one row per market (PT) per day: the PT implied APY against the IBT's own rate.-- EVM gold_pt_yields and Stellar gold_pt_yields.-- 'lp' one row per pool per day: what an LP earns (EVM gold_lp_yields; Stellar has no pools).-- Columns that do not apply to a row type are NULL. Column meanings across both types:-- implied_apy the PT implied APY (day's last trade, carried forward)-- ibt_apy_1d/7d/30d the IBT's own realized rate (gold_lp_yields calls it ibt_vault_apy)-- lp_pt_apy_*, lp_ibt_apy_* the PT and IBT parts of LP APY, weighted by their pool share-- (gold_lp_yields pt_apy and ibt_apy)-- fees_apy, rewards_apy, expected_apy (= pt + ibt + fees), total_apy (+ rewards),-- realized_lp_apy as in gold_lp_yields. APYs are decimals (0.05 = 5%).-- Rate guards and columns added 2026-11-03 for the yield derivatives sector models (bwr yield_derivatives__fct_market_rates),-- with the rules of Pendle's 8306903. On 'pt' rows, implied_apy, ibt_apy_7d, ibt_apy_30d and spread_30d are NULL where the-- value is not a usable rate; the unguarded values are in the new *_raw columns, and the *_flag columns name the guard.-- 'lp' rows are not guarded (their *_raw columns equal the guarded ones).-- implied_apy_flag 'thin_pool': the market's pool TVL is under $1k (gold_amm_balances tvl_usd, the last known value carried-- over days with no USD price); a market with no pool, as on Stellar, never triggers it.-- 'last_day': under one day to maturity, where the PT is at par and the rate carries no information.-- ibt_apy_7d_flag, ibt_apy_30d_flag 'outlier': above 200%, a one-off jump in the IBT rate compounded over the window.-- spread_30d NULL when implied_apy or ibt_apy_30d is guarded.-- amm_tvl_usd the pool TVL the thin_pool guard read-- Labels, after the existing columns:-- market_name the IBT's asset (IBT symbol without its 'sw-' wrapper prefix) and the maturity day, as in 8878793-- asset_symbol the IBT symbol without its 'sw-' wrapper prefix-- maturity maturity month, MONYYYY, as in Pendle's 8306900-- status 'matured' from the maturity day on, else 'active' (rows end before maturity)-- days_to_maturity days from block_date to the maturity day; 0 from then on-- pt_price_usd USD PT mark from silver_pt_prices_daily (pt rows only; NULL on lp).-- yt_price_usd USD YT mark from the same table (pt rows only; NULL on lp).-- Excluded: avalanche_c mevUSDC (IBT mevUSDC or sw-mevUSDC). Stream Finance xUSD exploit; share rate collapsed,-- so IBT-based APYs are meaningless. Balances, AMM volume and financials use the same ibt_symbol rule.-- Asset category (added 2026-10-02): token_category, token_sector, token_subsector, with the-- column names, values and rules of Pendle's ingest (Dune 8306900).-- token_category evms_tokens__gold_erc20 on the market's underlying ('project' and-- 'project-tokens' -> 'projects', typo 'tokenized-asseets' -> 'tokenized-assets').-- Where erc20 has no category (and on Stellar), name rules on the underlying-- symbol, or on the IBT symbol without its 'sw-' wrapper prefix when the-- underlying is NULL, first match wins: native gas tokens -> blockchains;-- GLP-style LP baskets -> composites; eTHENA, RZR -> projects; btc -> blockchains;-- eth, lrt -> liquid-staking; usd, dai, frax, gho, dola, eur, USR, USN, RLP ->-- stablecoins; pendle, spectra, crv, silo, eigen, obol -> projects;-- wOS, wanS, OS, anS, kmHYPE -> liquid-staking; else 'Other'.-- token_sector, token_subsector from erc20 only; NULL where erc20 has no row.-- Cost: erc20 is read only on the chain partitions listed in `erc` and only for the underlyings-- in spectra_evms__dim_markets (semi-join). Add a chain to that list when Spectra launches there.WITH und AS (SELECT DISTINCT underlying_addressFROM dune.blockworks_research.spectra_evms__dim_marketsWHERE underlying_address IS NOT NULL),erc AS (SELECTblockchain,CAST(token_address AS varchar) AS underlying_address,CASEWHEN token_category IN ('project', 'project-tokens') THEN 'projects'WHEN token_category = 'tokenized-asseets' THEN 'tokenized-assets'ELSE token_category