# yStats TVL, API, and APY Ideas ## Action Points - **General API** - **To Do:** Add Curve Compound Pool yVault to API - **To Do:** Add v2 yVaults to API - **yvWETH** - 0x18c447b7Ad755379B8800F1Ef5165E8542946Afd - Lend Yield Optimizer Strategy - 0x520a45E22B1eB5D7bDe09A445e70708d2957B365 - **yvDAI** - 0x1b048bA60b02f36a7b48754f4edf7E1d9729eBc9 - **TVL** - **Done:** ~~Add issue to GitHub to add a new field to strategy contracts~~ - `isDelegated` or `includeInTVL` - Boolean, - `isActive` - Boolean, to help identify active vs non-active strategies - Issue here: https://github.com/iearn-finance/yearn-vaults/issues/113 - **To Do:** Update current API endpoint with TVL info, provide the data for anyone who needs it - https://hackmd.io/A8KaWo4CS5qCip65AQpVmA?both - This includes detailed instructions at the bottom (**Directions for API**) that should be very simple to convert to code for an API for anyone who's done this before—I just have zero experience - **To Do:** Get this updated on DeFi Pulse, DeFi Llama, DeBank, CoinGecko and maybe even CMC - Current DeFi Pulse Adapter - https://github.com/ConcourseOpen/DeFi-Pulse-Adapters/blob/master/projects/yearn/index.js - **To Do:** Updated TVL with info from v2 yVaults once people start depositing into them - **APY** - While APY is tracked by default in v2 vaults, still need to manually track this in v1 - **Problem:** Current API seems to use APR, not APY - `apyLoanscan = ((1 + poolPct) * (1 + vaultPct) - 1) * 100` - https://github.com/iearn-finance/yearn-api/blob/5c873d7dcadbc357f1e49391cf3722b0c6cda9ac/services/vaults/apy/save/handler.js#L217 - **Solution:** Instead, the following would be ideal - Create two new `const`, `poolTrueAPY` and `vaultTrueAPY` - `poolTrueAPY = ((1+poolPct/365)^365-1)` - Realistically, the Curve pools are continually compounding, but 1 per day should be a fine approximation. - `vaultTrueAPY = ((1+vaultPct/52)^52-1)` - Again, vaults almost all compound more than once per week, but this should be a fine approximation. - Ideally, we would set the number of periods to be equal to number of `harvest` calls per year, but we can do that later if we get bored and want to be really exact. - `apyLoanscan = ((1 + poolTrueAPY) * (1 + vaultTrueAPY) - 1) * 100` - I would also recommend replacing all usage of `poolApy` with `poolApr`, since this value is indeed tracking APR and not APY. The same goes for changing the name of `getApy` to `getApr`, and any other usage where APY is incorrectly used in place of APR. - **Problem:** 3crv is missing from `pools` - **Solution:** Add 3crv to list of `pools` - https://github.com/iearn-finance/yearn-api/blob/5c873d7dcadbc357f1e49391cf3722b0c6cda9ac/services/vaults/apy/save/handler.js#L33 - Symbol: 3crv - Contract: 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7 - APY in v2 yVaults - APR is currently set to be reported at the strategy-level in v2 via the `estimatedAPR` field. - PR waiting to merge by doggie to add 12- and 50-day EMAs of each strategy's annualied returns, as well as a debt-weighted sum of the Vault's overall annualized return utilizing the EMAs of all connected strategies. - https://github.com/iearn-finance/yearn-vaults/pull/69