Use the official apify-client SDK to run the DeFiLlama Yield Scanner and pull results into Python. These are client-side usage examples.
pip install apify-clientSet your token (from Apify → Integrations):
export APIFY_TOKEN=apify_api_xxxxxxxxxxxxxxxxxxxxximport os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("logiover/defillama-yield-scanner").call(run_input={
"chains": ["Ethereum", "Solana"],
"minApy": 8,
"minTvlUsd": 1_000_000,
"sort": "apy",
"maxResults": 250,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(f"Got {len(items)} pools")
for p in items[:10]:
print(f'{p["apy"]:>6.2f}% {p["symbol"]:<12} {p["project"]} ({p["chain"]})')import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("logiover/defillama-yield-scanner").call(run_input={
"stablecoinOnly": True,
"minApy": 6,
"minTvlUsd": 1_000_000,
"sort": "apy",
"maxResults": 200,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
safe = sorted(
(p for p in items if p.get("ilRisk") == "no"),
key=lambda p: p["apy"],
reverse=True,
)[:15]
for p in safe:
print(f'{p["apy"]:>6.2f}% {p["symbol"]:<12} {p["project"]} ({p["chain"]}) TVL ${p["tvlUsd"]:,.0f}')import os
import pandas as pd
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("logiover/defillama-yield-scanner").call(run_input={
"sort": "tvl",
"maxResults": 5000,
})
df = pd.DataFrame(client.dataset(run["defaultDatasetId"]).iterate_items())
# Top 20 real-yield pools (mostly base APY, not emissions) with >= $5M TVL
real = df[(df["tvlUsd"] >= 5_000_000)].copy()
real["reward_share"] = real["apyReward"].fillna(0) / real["apy"].replace(0, pd.NA)
print(
real[real["reward_share"] < 0.25]
.sort_values("apy", ascending=False)
.head(20)[["project", "symbol", "chain", "apy", "apyBase", "tvlUsd"]]
.to_string(index=False)
)
df.to_csv("yields.csv", index=False)
print(f"Saved {len(df)} pools to yields.csv")import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("logiover/defillama-yield-scanner").call(run_input={
"projects": ["aave", "compound", "morpho", "spark"],
"sort": "apy",
"maxResults": 2000,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
usdc = [p for p in items if p.get("symbol") == "USDC"]
for p in sorted(usdc, key=lambda p: p["apy"], reverse=True):
print(f'{p["apy"]:>6.2f}% {p["project"]:<14} {p["chain"]:<12} TVL ${p["tvlUsd"]:,.0f}')See the full input/output reference in the main README.