All code examples use the TypeScript SDK (
@vaultsfyi/sdk). The Python SDK exposes the same functionality using snake_case method names. See the SDK Reference for both.Initialize the client
analytics.js
Step 1: Fetch and filter vault listings
UsegetAllVaults to retrieve available vaults. Apply filters to narrow results by network, protocol, asset, or TVL range. Use page and perPage to paginate through large result sets.
analytics.js
Step 2: Fetch historical APY and TVL data
Once you have a vault of interest, use the historical data methods to pull time-series metrics. Choose between the combined endpoint or the lighter focused endpoints depending on what you need.Fetch combined APY and TVL history
analytics.js
apyInterval parameter controls the smoothing window for APY values. Use '1day' for precise daily readings, '7day' for a weekly moving average, or '30day' for a longer-term trend line.
Fetch APY-only history
UsegetVaultHistoricalApy when you only need APY data and want a lighter API response.
analytics.js
Fetch TVL-only history
UsegetVaultHistoricalTvl to track capital flow into and out of a vault over time.
analytics.js
Step 3: Compare against benchmark rates
Benchmark rates let you put vault APY in context. UsegetBenchmarks to retrieve the current reference rate, and getHistoricalBenchmarks to overlay it on your APY chart.
Fetch current benchmarks
analytics.js
Fetch historical benchmarks
analytics.js
Step 4: Assemble a vault report
Combine the methods above to build a complete snapshot for a single vault. The example below fetches current data, 30-day APY history, and the benchmark comparison in parallel.analytics.js
Step 5: Handle errors and pagination
Wrap API calls in error handling and iterate over pages for large data sets.Error handling
analytics.js
Paginating through all vaults
analytics.js
What to build next
With vault listings, historical data, and benchmarks in hand, you can:- Render an APY chart — plot
apyHistoryas a line series withhistoricalBenchmarksas a reference line using any charting library (Recharts, Chart.js, Observable Plot). - Build a protocol leaderboard — sort vaults by 30-day average APY or by TVL growth to identify top-performing strategies.
- Track historical share price — use
getVaultHistoricalSharePriceto calculate compounded returns over any period for a more accurate performance metric than raw APY. - Export to CSV or JSON — serialize the assembled report into a flat file for use in spreadsheets, notebooks, or downstream data pipelines.

