> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webacy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitor Stablecoin Depeg Risk

> Build real-time stablecoin depeg alerts and portfolio monitoring across 600+ pegged tokens with 5-minute risk ratings on seven EVM chains using Webacy.

In March 2023, USDC depegged to $0.87 after Silicon Valley Bank collapsed — $3.3B of Circle's reserves were locked. Treasuries holding USDC lost millions in hours. The depeg was detectable within minutes through on-chain price deviation and liquidity signals. This guide shows you how to monitor 600+ pegged tokens in real-time across 7 EVM chains.

## Why Depeg Monitoring Matters

<CardGroup cols={3}>
  <Card title="Portfolio Protection" icon="shield-halved">
    Detect depeg risk before it becomes a loss — minutes matter when a stablecoin breaks its peg
  </Card>

  <Card title="Early Warning" icon="bell">
    Get ahead of the market with 5-minute rating updates across price deviation, liquidity, and volatility
  </Card>

  <Card title="Compliance" icon="gavel">
    Document stablecoin risk for regulatory reporting and treasury management policies
  </Card>
</CardGroup>

**Why teams choose Webacy for depeg monitoring:**

* **600+ pegged tokens** — Stablecoins, RWAs, gold-backed, and yield-bearing tokens
* **5-minute updates** — Ratings refresh every 5 minutes using 5 weighted signals (with headroom reserved for future expansion)
* **Multi-factor model** — Price deviation (30%), slippage (20%), persistence at 50bp (18%) and 100bp (12%), volatility burst (10%)
* **7 EVM chains** — ETH, ARB, POL, OPT, BASE, BSC, Linea from a single API

***

## Prerequisites

Before implementing depeg monitoring, ensure you have:

* A Webacy API key ([sign up here](https://developers.webacy.co/billing))
* Basic familiarity with REST APIs or the [Webacy SDK](/sdk/installation)
* Your treasury, portfolio, or exchange workflow identified for integration points

***

## Screen Stablecoins by Risk Tier

Get an overview of all stablecoins with their current depeg risk rating.

<CodeGroup>
  ```bash cURL theme={null}
  # High-cap stablecoins sorted by risk
  curl -X GET "https://api.webacy.com/rwa?sort=score&order=desc&minMcap=1000000000&pageSize=25" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    'https://api.webacy.com/rwa?sort=score&order=desc&minMcap=1000000000&pageSize=25',
    { headers: { 'x-api-key': process.env.WEBACY_API_KEY } }
  );
  const { data } = await response.json();

  for (const token of data) {
    console.log(`${token.symbol} | Rating: ${token.riskScore}/100 | Tier: ${token.tier}`);
  }
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.webacy.com/rwa",
      params={"sort": "score", "order": "desc", "minMcap": 1000000000, "pageSize": 25},
      headers={"x-api-key": "YOUR_API_KEY"}
  )
  tokens = response.json()["data"]
  ```
</CodeGroup>

**Risk tier interpretation:**

| Tier       | Rating   | What It Means        | Action                                           |
| ---------- | -------- | -------------------- | ------------------------------------------------ |
| `critical` | >= 80    | Severe depeg risk    | Immediate attention — consider reducing exposure |
| `warning`  | 60-79    | Elevated risk        | Close monitoring, prepare contingency            |
| `watch`    | 40-59    | Early stress signals | Track trends, increase monitoring frequency      |
| `ok`       | under 40 | Normal conditions    | Routine monitoring                               |
| `premium`  | N/A      | Trading above peg    | Positive deviation — monitor for reversal        |

***

## Monitor a Specific Token

Get the full depeg snapshot for a token, including historical time series.

<CodeGroup>
  ```bash cURL theme={null}
  # USDC on Ethereum with 7-day history
  curl -X GET "https://api.webacy.com/rwa/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48?chain=eth&hours=168" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    'https://api.webacy.com/rwa/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48?chain=eth&hours=168',
    { headers: { 'x-api-key': process.env.WEBACY_API_KEY } }
  );
  const detail = await response.json();

  console.log(`${detail.symbol} — Rating: ${detail.riskScore}/100`);
  console.log(`Price: $${detail.price}`);
  console.log(`Tier: ${detail.tier}`);
  console.log(`Depeg events (7d): ${detail.depegEvents?.length ?? 0}`);
  ```

  ```python Python theme={null}
  response = requests.get(
      "https://api.webacy.com/rwa/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      params={"chain": "eth", "hours": 168},
      headers={"x-api-key": "YOUR_API_KEY"}
  )
  detail = response.json()
  ```
</CodeGroup>

**Key response fields:**

| Field           | Description                                         | Action                               |
| --------------- | --------------------------------------------------- | ------------------------------------ |
| `riskScore`     | 0-100 composite depeg rating                        | Set alert thresholds                 |
| `tier`          | `ok` / `watch` / `warning` / `critical` / `premium` | Quick categorization                 |
| `price`         | Current token price                                 | Track deviation from \$1.00          |
| `risk.issues[]` | Array of risk tags with severity                    | Understand what's driving the rating |
| `depegEvents`   | Historical depeg event records                      | Assess track record                  |
| `timeSeries`    | Rating history over requested period                | Spot trends                          |

***

## Build a Stablecoin Risk Dashboard

Filter and aggregate stablecoin risk across your portfolio.

<CodeGroup>
  ```bash cURL theme={null}
  # All stablecoins on Ethereum, sorted by risk
  curl -X GET "https://api.webacy.com/rwa?chain=eth&sort=score&order=desc&pageSize=50" \
    -H "x-api-key: YOUR_API_KEY"

  # Only tokens in stress (watch tier or worse)
  curl -X GET "https://api.webacy.com/rwa?tier=warning&sort=score&order=desc" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```typescript TypeScript theme={null}
  async function fetchStablecoinDashboard(chain?: string) {
    const params = new URLSearchParams({
      sort: 'score',
      order: 'desc',
      pageSize: '50',
    });
    if (chain) params.set('chain', chain);

    const response = await fetch(
      `https://api.webacy.com/rwa?${params}`,
      { headers: { 'x-api-key': process.env.WEBACY_API_KEY } }
    );
    return response.json();
  }

  const dashboard = await fetchStablecoinDashboard('eth');

  // Group by tier for a summary view
  const byTier = { critical: [], warning: [], watch: [], ok: [], premium: [] };
  for (const token of dashboard.data) {
    byTier[token.tier]?.push(token);
  }

  console.log(`Critical: ${byTier.critical.length}`);
  console.log(`Warning: ${byTier.warning.length}`);
  console.log(`Watch: ${byTier.watch.length}`);
  console.log(`OK: ${byTier.ok.length}`);
  ```

  ```python Python theme={null}
  params = {
      "chain": "eth",
      "sort": "score",
      "order": "desc",
      "pageSize": 50,
  }
  response = requests.get(
      "https://api.webacy.com/rwa",
      params=params,
      headers={"x-api-key": "YOUR_API_KEY"}
  )
  dashboard = response.json()
  ```
</CodeGroup>

***

## Complete Integration Workflow

Here's how depeg monitoring fits into a typical treasury or exchange.

### Monitoring Flow

```mermaid theme={null}
flowchart TD
    A[Fetch Stablecoin List] --> B{Check Each Token}
    B --> C{Tier?}
    C -->|critical| D[Immediate Alert]
    C -->|warning| E[Escalate to Risk Team]
    C -->|watch| F[Increase Monitoring]
    C -->|ok| G[Log and Continue]
    D --> H{Action Required}
    H -->|Reduce Exposure| I[Rebalance Portfolio]
    H -->|Investigate| J[Fetch Token Detail + History]
    F --> K[Check Again in 5 Minutes]
    G --> K
```

### Implementation Example

<Accordion title="Full TypeScript Implementation">
  ```typescript theme={null}
  const API_BASE = 'https://api.webacy.com';
  const API_KEY = process.env.WEBACY_API_KEY;

  const headers = { 'x-api-key': API_KEY };

  // Fetch all stablecoins with risk data
  async function fetchStablecoins(chain?: string) {
    const params = new URLSearchParams({
      sort: 'score',
      order: 'desc',
      pageSize: '100',
    });
    if (chain) params.set('chain', chain);

    const res = await fetch(`${API_BASE}/rwa?${params}`, { headers });
    const { data } = await res.json();
    return data;
  }

  // Get detailed risk for a specific token
  async function getTokenDetail(address: string, chain: string, hours = 168) {
    const res = await fetch(
      `${API_BASE}/rwa/${address}?chain=${chain}&hours=${hours}`,
      { headers }
    );
    return res.json();
  }

  // Classify tokens by risk tier
  function classifyRisk(tokens: any[]) {
    const alerts = { critical: [], warning: [], watch: [] };

    for (const token of tokens) {
      if (token.tier === 'critical') alerts.critical.push(token);
      else if (token.tier === 'warning') alerts.warning.push(token);
      else if (token.tier === 'watch') alerts.watch.push(token);
    }

    return alerts;
  }

  // Monitor a portfolio of stablecoins
  async function monitorPortfolio(holdings: { address: string; chain: string }[]) {
    const results = [];

    for (const { address, chain } of holdings) {
      const detail = await getTokenDetail(address, chain);
      results.push({
        symbol: detail.symbol,
        chain,
        riskScore: detail.riskScore,
        tier: detail.tier,
        price: detail.price,
      });
    }

    // Sort by risk (highest first)
    results.sort((a, b) => b.riskScore - a.riskScore);

    for (const token of results) {
      const icon = token.tier === 'critical' ? '!!' :
                   token.tier === 'warning' ? '!' : '-';
      console.log(
        `[${icon}] ${token.symbol} (${token.chain}) — ` +
        `Rating: ${token.riskScore}/100, Price: $${token.price}`
      );
    }

    return results;
  }

  // Example: monitor a treasury portfolio
  await monitorPortfolio([
    { address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', chain: 'eth' },  // USDC
    { address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', chain: 'eth' },  // USDT
    { address: '0x6B175474E89094C44Da98b954EedeAC495271d0F', chain: 'eth' },  // DAI
  ]);
  ```
</Accordion>

***

## API Quick Reference

| Endpoint                           | Use Case                               | Response Time |
| ---------------------------------- | -------------------------------------- | ------------- |
| `GET /rwa`                         | List all pegged tokens with depeg risk | \~300ms       |
| `GET /rwa/{address}?chain={chain}` | Full depeg detail with time series     | \~500ms       |

**Authentication:**

```text theme={null}
Header: x-api-key: YOUR_API_KEY
Base URL: https://api.webacy.com
Supported chains: eth, arb, pol, opt, base, bsc, linea
```

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Depeg Monitor API" icon="chart-line" href="/api-reference/depeg-monitor">
    Full endpoint reference with all query parameters
  </Card>

  <Card title="Vault Risk Screening" icon="vault" href="/guides/vault-risk-screening">
    Screen and monitor the vaults that hold your stablecoins
  </Card>

  <Card title="Exchange Wallet Screening" icon="building-columns" href="/guides/exchange-wallet-screening">
    Screen deposits and withdrawals for compliance
  </Card>

  <Card title="Risk Tags Reference" icon="tags" href="/essentials/risk-tags">
    Complete list of all risk tags and what they mean
  </Card>
</CardGroup>
