# DeFi Scraper — TVL, Yields, Chains & Stablecoins (`hichemdev/defi-scraper`) Actor

Scrape DeFi data from DefiLlama: 8,400+ protocols with TVL and 1d/7d change, 460+ chains, 16,000+ yield pools with APY, base vs reward APY, impermanent-loss risk and volume, plus stablecoin supply and peg data. Filter by chain, category, project or TVL. No API key.

- **URL**: https://apify.com/hichemdev/defi-scraper.md
- **Developed by:** [Hichem Ben Moussa](https://apify.com/hichemdev) (community)
- **Categories:** Business, Developer tools, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 records

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## DeFi Scraper — TVL, Yields, Chains & Stablecoins

Scrape **DeFi market data from DefiLlama** — the reference source for on-chain value — across four datasets: **8,400+ protocols** with TVL, **16,000+ yield pools** with APY, **460+ chains**, and **400+ stablecoins** with supply and peg data.

No API key required.

### Four datasets, one actor

| Mode | Records | What it answers |
|---|---|---|
| **Protocols** | ~8,400 | Where is the money, by protocol and category, and which way is it moving |
| **Yield pools** | ~17,000 | What can I earn, at what TVL, base vs reward APY, and how risky |
| **Chains** | ~470 | How much value each chain holds |
| **Stablecoins** | ~430 | Supply, peg mechanism, price, and growth by chain |

### What you get — protocols

| Field | Description |
|---|---|
| `name`, `slug`, `symbol` | Protocol identity |
| `category` | Dexes, Lending, Liquid Staking, CEX, Bridge… |
| `chain`, `chains`, `chainCount` | Primary chain and every chain it runs on |
| `tvlUsd` | Total value locked |
| `change1h`, `change1d`, `change7d` | TVL momentum in percent |
| `marketCapUsd`, `mcapToTvl` | Token market cap and the **mcap/TVL ratio** — the standard cheap-or-expensive screen |
| `audits` | Audit status, with `0` reported as `none` |
| `description`, `website`, `twitter`, `logo` | Profile data |
| `listedAt` | When DefiLlama first listed it — useful for spotting new protocols |

### What you get — yield pools

| Field | Description |
|---|---|
| `project`, `chain`, `symbol`, `poolMeta` | Which pool, where |
| `tvlUsd` | Pool size |
| `apy` | Total APY |
| `apyBase` vs `apyReward` | **Organic yield vs token emissions** — the single most important distinction in yield farming |
| `apyMean30d` | 30-day mean, far more honest than a spot number |
| `apyChange1d/7d/30d` | Whether the yield is decaying |
| `isStablecoin`, `impermanentLossRisk`, `exposure` | Risk shape |
| `volumeUsd1d`, `volumeUsd7d` | Trading volume behind fee yield |
| `isOutlier` | DefiLlama's own flag for statistically implausible APY |
| `predictedDirection`, `predictedProbability` | DefiLlama's APY outlook |

### Example input

```json
{
  "dataType": "yields",
  "chain": "Ethereum",
  "stablecoinPoolsOnly": true,
  "minTvlUsd": 5000000,
  "minApy": 5,
  "maxItems": 100
}
```

Screen protocols by category:

```json
{ "dataType": "protocols", "category": "Lending", "minTvlUsd": 100000000 }
```

Track stablecoin supply:

```json
{ "dataType": "stablecoins", "minTvlUsd": 1000000000 }
```

### Example output

```json
{
  "dataType": "pool",
  "project": "lido",
  "chain": "Ethereum",
  "symbol": "STETH",
  "tvlUsd": 26335491213,
  "apy": 2.245,
  "apyBase": 2.245,
  "apyReward": null,
  "apyMean30d": 2.31,
  "isStablecoin": false,
  "impermanentLossRisk": "no",
  "exposure": "single",
  "isOutlier": false,
  "url": "https://defillama.com/yields/pool/747c1d2a-c668-4682-b9f9-296708a3dd90"
}
```

### Who uses this

- **Yield aggregators and dashboards** — a complete pool universe with base/reward split, refreshed on a schedule
- **Crypto funds and analysts** — TVL flows by category and chain, and mcap/TVL screens
- **Risk teams** — exposure type, impermanent-loss risk and outlier flags before allocating
- **Research and newsletters** — 7-day TVL movers, new protocol listings, stablecoin supply shifts
- **Treasury management** — where large stablecoin yields actually exist at a given TVL floor
- **Chain ecosystem teams** — benchmark your chain's TVL and protocol mix against competitors

### Things worth knowing

- **Results are sorted largest-first** before `maxItems` is applied, so a run of 50 gives you the 50 biggest matches, not an arbitrary slice.
- **`apyReward` is the number to be suspicious of.** A 40% APY that is all rewards is a token-emission subsidy that can stop at any time; `apyBase` is fee-derived yield. `apyMean30d` and `apyChange30d` tell you whether it is already decaying.
- **Outlier pools are excluded by default.** DefiLlama flags pools whose reported APY is statistically implausible; these are usually broken or manipulated. Turn the filter off if you want to see them.
- **Filters match exactly**, using DefiLlama's own spelling — `Ethereum`, not `ethereum` or `ETH`; `Dexes`, not `DEX`. The actor tells you when everything was filtered out so a typo does not look like an empty market.
- **These payloads are large** — the protocol list is ~9 MB and the yield list ~12 MB. The actor requests them compressed and filters server-side data locally; expect a few seconds of download on the yields mode.
- **TVL is a point-in-time snapshot** at run time, not a historical series. Schedule the actor to build your own time series.

### Pricing

Pay per result. Each protocol, pool, chain or stablecoin returned counts as one result, and all filters are applied before charging — so a tight screen over 17,000 pools bills only for the handful that match.

### Notes

- Data comes from DefiLlama's public API.
- Nothing here is financial advice, and APY figures are the protocol's own reporting as DefiLlama collects it.
- This is an unofficial actor and is not affiliated with DefiLlama.

# Actor input Schema

## `dataType` (type: `string`):

Which DefiLlama dataset to pull.

## `chain` (type: `string`):

Exact chain name, e.g. Ethereum, Arbitrum, Solana, Base. Matched exactly, so use DefiLlama's spelling.

## `category` (type: `string`):

Protocol category, e.g. Dexes, Lending, Liquid Staking, CEX, Bridge.

## `project` (type: `string`):

Project slug for yield pools, e.g. lido, aave-v3, uniswap-v3.

## `symbol` (type: `string`):

Token or pool symbol, e.g. USDC, STETH, WETH.

## `minTvlUsd` (type: `integer`):

Keep only records at or above this TVL (or circulating supply, for stablecoins).

## `minApy` (type: `integer`):

Keep only pools with at least this APY.

## `stablecoinPoolsOnly` (type: `boolean`):

Yield pools only: keep pools whose assets are stablecoins.

## `excludeOutliers` (type: `boolean`):

Yield pools only: drop pools DefiLlama flags as statistical outliers, which usually have unreliable APY.

## `maxItems` (type: `integer`):

Stop after this many records. Results are sorted largest-first, so you get the biggest ones.

## `proxyConfiguration` (type: `object`):

Optional. A proxy is not required for this actor.

## Actor input object example

```json
{
  "dataType": "protocols",
  "minTvlUsd": 1000000,
  "stablecoinPoolsOnly": false,
  "excludeOutliers": true,
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped items as JSON.

## `overview` (type: `string`):

Browse results in the Apify Console.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "dataType": "protocols",
    "minTvlUsd": 1000000,
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("hichemdev/defi-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "dataType": "protocols",
    "minTvlUsd": 1000000,
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("hichemdev/defi-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "dataType": "protocols",
  "minTvlUsd": 1000000,
  "maxItems": 50
}' |
apify call hichemdev/defi-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hichemdev/defi-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/EnJfCSC1XiXb9YNya/builds/BRlbUOqOtaefIfdgX/openapi.json
