npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

stablecoin-yield

v0.1.0

Published

The official Barker JS/TS SDK for stablecoin yield data — real-time APY/TVL from 500+ DeFi protocols across 40+ chains, plus market overview and historical APY trend. Zero dependencies, Node 18+.

Readme

stablecoin-yield

The official Barker JS/TS SDK for stablecoin yield data — real-time APY/TVL from 500+ DeFi protocols across 40+ chains, plus market overview and historical APY trend vs US Treasury. Zero dependencies, Node 18+.

Powered by Barker — The Stablecoin Yield Map.

npm install stablecoin-yield

Quick Start

import { getVaults, formatApy } from 'stablecoin-yield';

// Top 5 USDC yields right now
const vaults = await getVaults({ asset: 'usdc', sort: 'apy', limit: 5 });

for (const v of vaults) {
  console.log(
    `${v.protocolName} (${v.chainName})  ${formatApy(v.supplyApyTotal)}  $${v.supplyTvl.toLocaleString()}`
  );
}
//  Sky (Ethereum)  3.75%  $6,350,244,063
//  Aave (Arbitrum) 3.42%  $1,210,455,028
//  ...

API Surface

Default client (zero config)

The simplest path — uses the public Barker API, no key required.

import { getVaults, getMarketOverview, getMarketTrend } from 'stablecoin-yield';

const vaults = await getVaults({ asset: 'usdc', sort: 'apy', limit: 10 });
const overview = await getMarketOverview();
const trend = await getMarketTrend({ days: 30 });

Custom client

For custom config (timeouts, base URL, alternate fetch), instantiate Barker.

import { Barker } from 'stablecoin-yield';

const barker = new Barker({
  baseUrl: 'https://api.barker.money/api/public/v1',  // default
  timeoutMs: 5_000,                                    // default 10000
  // fetch: customFetch,                               // optional
  // userAgent: 'my-app/1.0',                          // optional
});

const vaults = await barker.getVaults({ minTvl: 1_000_000, limit: 20 });

Error handling

All non-2xx responses, timeouts, and success: false payloads throw a BarkerApiError.

import { getVaults, BarkerApiError } from 'stablecoin-yield';

try {
  const v = await getVaults({ asset: 'usdc' });
} catch (err) {
  if (err instanceof BarkerApiError) {
    console.error('Barker API failed:', err.status, err.endpoint);
  } else {
    throw err;
  }
}

Methods

getVaults(options?)DefiVault[]

Real-time DeFi yield pools, sorted by APY (default).

Options:

| Field | Type | Description | |---|---|---| | asset | string | Stablecoin symbol filter, e.g. 'usdc', 'usdt', 'dai' | | chain | string | Chain filter, e.g. 'ethereum', 'arbitrum', 'base' | | protocol | string | Protocol uid filter, e.g. 'aave', 'compound' | | sort | 'apy' \| 'tvl' | Default: 'apy' | | order | 'asc' \| 'desc' | Default: 'desc' | | limit | number | Max items | | offset | number | Pagination offset | | minTvl | number | Minimum TVL in USD (excludes tiny exotic pools) |

Returns DefiVault[] with camelCase fields — see index.d.ts for the full type. APY fields are decimal (see "APY units" below).

getMarketOverview()MarketOverview

Total stablecoin market cap, asset/chain distribution, summary.

const ov = await getMarketOverview();

console.log(`Total: $${(ov.stablecoinMcap.total / 1e9).toFixed(1)}B`);
console.log(`Yield-bearing: $${(ov.stablecoinMcap.yieldBearing / 1e9).toFixed(1)}B`);

for (const a of ov.assetDistribution.slice(0, 5)) {
  console.log(`  ${a.assetSymbol}: ${(a.sharePct * 100).toFixed(1)}% of TVL`);
}

getMarketTrend({ days? })MarketTrendPoint[]

Historical APY trend (avg / median / TVL-weighted) with US 3-month Treasury benchmark.

const trend = await getMarketTrend({ days: 30 });
const latest = trend.at(-1)!;

console.log(`Median DeFi: ${formatApy(latest.medianApy)}`);
console.log(`US Treasury 3m: ${formatApy(latest.treasuryYield3m)}`);
console.log(`Spread: ${formatApy(latest.medianApy - latest.treasuryYield3m)}`);

APY units — the one rule

All APY fields returned by the API and this SDK are decimal, where:

  • 0.0523 means 5.23%
  • 0.10 means 10%
  • 3.0007 means 300.07% (a campaign pool, not a typo)

This matches Barker's internal storage. The trap to avoid: don't divide by 100 again when you see a value ≥ 1 — it's already a multiplier, not a percentage.

Use the built-in helpers to stay safe:

import { apyToPct, pctToApy, formatApy } from 'stablecoin-yield';

apyToPct(0.0523);      // 5.23   (decimal → percent number)
pctToApy(5.23);        // 0.0523 (percent number → decimal)
formatApy(0.0523);     // "5.23%"
formatApy(0.0523, 1);  // "5.2%"
formatApy(null);       // "—"

Public API limits

  • Rate limit: 30 req/min per IP
  • Auth: none — fully public read-only
  • Sensitive data: never sent. Only public market parameters (symbol, chain, sort, limit) leave your machine.

Need higher limits, CEX per-venue detail, or historical raw data? See app.barker.money/enterprise.

TypeScript

Types ship with the package. No @types/... needed:

import type { DefiVault, MarketTrendPoint } from 'stablecoin-yield';

Related

License

MIT