Official JavaScript/TypeScript SDK for the PegCheck stablecoin monitoring API.
Monitor 19 stablecoins in real time — prices, peg deviations, depeg alerts, whale activity and on-chain history.
npm install pegcheck-jsRequires Node.js 18 or later (uses native fetch).
import PegCheck from "pegcheck-js";
const client = new PegCheck("your-api-key");
// Get all 19 stablecoin prices
const coins = await client.getAllPrices();
console.log(coins);
// Check a single coin
const usdt = await client.getPrice("usdt");
console.log(usdt.price, usdt.status, usdt.deviation_bps);
// Is USDT depegged right now?
const depegged = await client.isDepegged("usdt");
console.log(depegged); // falseGet your API key at pegcheck.uk/developers.
Creates a new client instance.
const client = new PegCheck("pc_live_xxxxxxxxxxxx");Returns live prices, status and deviation for all 19 tracked stablecoins.
const coins = await client.getAllPrices();
// [
// { slug: "usdt", name: "USDT", price: 1.0002, peg: 1.0, deviation_bps: 2, status: "Healthy", ... },
// { slug: "usdc", name: "USDC", price: 0.9998, peg: 1.0, deviation_bps: -2, status: "Healthy", ... },
// ...
// ]Returns live data for a single coin.
const coin = await client.getPrice("usdc");
console.log(`USDC is ${coin.status} at $${coin.price}`);Supported slugs: usdt, usdc, usds, ethena, pyusd, fdusd, rlusd, tusd, frax, gho, crvusd, lusd, usdp, usdd, mkusd, eurc, dola, alusd, bold
Returns true if the coin's current status is "Depeg".
if (await client.isDepegged("usdt")) {
console.log("USDT has depegged!");
}Returns all coins currently in "Caution" status (1–2.5% from peg).
const caution = await client.getCautionCoins();
caution.forEach(c => console.log(`${c.slug}: ${c.deviation_bps} bps from peg`));Returns all coins currently in "Depeg" status (>2.5% from peg).
const depegged = await client.getDepeggedCoins();
if (depegged.length > 0) {
console.log("DEPEGS DETECTED:", depegged.map(c => c.slug));
}Returns recent large on-chain transfers (≥$1M) and current alert status across all monitored coins.
const alerts = await client.getWhaleActivity();
console.log(`${alerts.whaleTransfers.length} whale transfers in the last 7 days`);Registers a webhook to receive real-time POST notifications for depeg, caution, and recovery events.
const webhook = await client.registerWebhook(
"https://your-app.com/webhooks/pegcheck",
["depeg", "caution", "recovery"]
);
console.log(`Webhook registered: ${webhook.id}`);Webhook payload:
{
"event": "depeg",
"coin": "usdt",
"price": 0.9710,
"peg": 1.0,
"deviation_pct": -2.9,
"triggered_at": "2026-01-15T09:00:00.000Z"
}Returns price history for a coin. days defaults to 7, max 90.
const history = await client.getHistory("usdc", 30);
history.forEach(p => console.log(p.created_at, p.price, p.deviation_bps));import type {
CoinPrice,
CoinStatus,
HistoryPoint,
WhaleTransfer,
WhaleAction,
AlertsStatus,
Webhook,
WebhookEvent,
} from "pegcheck-js";All methods throw on API errors with a descriptive message and a status property:
try {
const coin = await client.getPrice("usdt");
} catch (err) {
if (err.status === 401) console.error("Invalid API key");
if (err.status === 429) console.error("Rate limit exceeded");
if (err.status === 404) console.error("Coin not found");
console.error(err.message);
}