# DeFi Stablecoin Yield Scanner (DefiLlama) (`drizzly_twilight/defi-stablecoin-yield-scanner`) Actor

Scans every DeFi lending/LP pool tracked by DefiLlama and returns stablecoin yields filtered by TVL, APY, chain and impermanent-loss risk. Output includes direct pool links.

- **URL**: https://apify.com/drizzly_twilight/defi-stablecoin-yield-scanner.md
- **Developed by:** [Cid Aric](https://apify.com/drizzly_twilight) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 defi yield pools

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Stablecoin Yield Scanner (DefiLlama)

Scans every DeFi lending and LP pool tracked by DefiLlama and returns stablecoin yields
filtered by TVL, APY, chain and impermanent-loss risk — with direct links to each pool.

### What it does

- Downloads the full DefiLlama pool dataset (15,000+ pools, refreshed hourly).
- Filters by minimum TVL, APY range, stablecoin flag and IL risk.
- Separates **base APY** (real lending/fee income) from **reward APY** (token subsidies).

### Input

| Field | Default | Meaning |
|---|---|---|
| `minTvlUsd` | `10000000` | Ignore pools smaller than this |
| `minApy` | `5` | Minimum APY (%) |
| `maxApy` | `200` | Maximum APY (%) — filters obvious scams |
| `stablecoinOnly` | `true` | Only stablecoin pools |
| `chains` | `[]` | Filter by chain, e.g. `Ethereum`, `Solana`, `Base` |
| `projects` | `[]` | Filter by project, e.g. `aave-v3`, `morpho-blue` |
| `excludeIl` | `true` | Exclude pools with impermanent-loss risk |
| `topN` | `100` | Max rows |

### Output

| Field | Meaning |
|---|---|
| `project` / `chain` / `symbol` | Protocol, chain, pool pair |
| `apy` | Total APY (base + reward) |
| `apy_base` | Sustainable portion |
| `apy_reward` | Subsidy portion (can drop to zero) |
| `tvl_usd` | Pool size |
| `url` | DefiLlama pool page |

### How much does it cost?

| Event | Price |
|---|---|
| `apify-default-dataset-item` (per result) | **$0.001** |
| `apify-actor-start` (per run) | **$0.005** |

A run returning 100 pools costs about **$0.11**.

### How to read the results

- `apy_base` is the real yield; `apy_reward` is a subsidy that can vanish overnight.
- Pools under ~$10M TVL are not worth the smart-contract risk regardless of APY.
- Data is sourced from DefiLlama and updated roughly hourly.

### Local run

```bash
python3 src/logic.py
```

# Actor input Schema

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

Ignores pools smaller than this.

## `minApy` (type: `number`):

Pools below this APY are dropped. Set 0 to see everything.

## `maxApy` (type: `number`):

Filters out obvious scams.

## `stablecoinOnly` (type: `boolean`):

When enabled, only pools whose symbol is a stablecoin pair (USDC, USDT, DAI, USDS...) are returned.

## `chains` (type: `array`):

e.g. Ethereum, Solana, Base

## `projects` (type: `array`):

e.g. aave-v3, morpho-blue

## `excludeIl` (type: `boolean`):

When enabled, AMM pools exposed to impermanent loss are filtered out. Keep enabled for single-sided lending yields.

## `topN` (type: `integer`):

Maximum number of pools written to the dataset, sorted by APY descending.

## Actor input object example

```json
{
  "minTvlUsd": 10000000,
  "minApy": 5,
  "maxApy": 200,
  "stablecoinOnly": true,
  "chains": [],
  "projects": [],
  "excludeIl": true,
  "topN": 100
}
```

# Actor output Schema

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

Each row is one lending or LP pool with APY breakdown, TVL, impermanent-loss risk and a direct link to DefiLlama.

## `summary` (type: `string`):

How many pools were downloaded from DefiLlama and how many matched the filters.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("drizzly_twilight/defi-stablecoin-yield-scanner").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("drizzly_twilight/defi-stablecoin-yield-scanner").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 '{}' |
apify call drizzly_twilight/defi-stablecoin-yield-scanner --silent --output-dataset

```

## MCP server setup

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

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/7bmD3A70ihdBKutJ3/builds/dtKfKcXLP2c0u8bh9/openapi.json
