← Cookbook

✅ runnable

Recipe 11 — Add a Yield strategy on Aave / Compound

Status: ✅ runnable SDK surface: client.strategies.create(kind="YIELD", params=...) TZ reference: TZ-3 §4.8

Identical shape to recipe 04 (DCA) but with kind="YIELD" and protocol- specific params. The server validates each protocol against the M3-S1 registry (apps/api/src/cryptoai_api/strategies/registry.py).

strat = await client.strategies.create(
    kind="YIELD",
    params={
        "protocol": "aave-v3",
        "asset": "USDC",
        "chain_id": 1,
        "deposit_usd": 10000,
        "auto_compound": True,
    },
)
const strat = await client.strategies.create({
  kind: 'YIELD',
  params: {
    protocol: 'aave-v3',
    asset: 'USDC',
    chain_id: 1,
    deposit_usd: 10000,
    auto_compound: true,
  },
});

See client.strategies.validate(strat.instance_id) to run the backtester before promoting to running.

Source: cookbook/recipes/11-yield-strategy/README.md