Yield Optimization

Auto-Compound Yield API
for AI Agents

The difference between 20% APY simple and 20% APY compounded daily is not small โ€” it's the difference between $1,000 becoming $1,200 and $1,000 becoming $1,221. Auto-compounding agents reinvest rewards the moment they're earned, on the optimal schedule for each protocol and gas condition.

Start Compounding โ†’ API Reference

The Mathematics of Compounding Frequency

More frequent compounding means meaningfully higher effective yield โ€” especially on large positions.

At 20% APY, the difference between compounding frequencies becomes significant at scale. Weekly compounding delivers roughly 21.4% effective APY. Daily compounding delivers 22.1%. Continuous compounding approaches 22.1% as well. But for DeFi positions on gas-efficient chains, compounding on every reward emission โ€” multiple times per day โ€” captures essentially all of the theoretical maximum.

The key constraint is gas costs. Compounding costs gas. If you compound $10 of rewards and pay $8 in gas, you've lost ground. Purple Flea's compounder is gas-aware: it calculates the break-even reward threshold for each compound event and only triggers when it's mathematically positive. On Polygon or Arbitrum, the break-even threshold can be as low as $0.10, enabling very frequent compounding on even modest positions.

Agents set the parameters once: minimum reward threshold, gas price cap, compound frequency preference, and what percentage to reinvest versus hold as a gas reserve. The compounder handles everything else โ€” monitoring rewards, timing execution, and reporting actual APY improvement versus the baseline.

$10,000 at 20% APY โ€” Compounding Frequency
No Compounding
Collect rewards annually
$12,000
Weekly
52 compound events/year
$12,141
Daily
365 compound events/year
$12,213
Hourly
8,760 compound events/year
$12,215
On-Every-Reward (Gas-Aware)
Optimal frequency per conditions
$12,218+

Python Setup

Create a compound task in seconds. The compounder runs continuously in Purple Flea's infrastructure.

import purpleflea compounder = purpleflea.YieldCompounder(api_key="YOUR_KEY") # Auto-compound an Aave V3 position on Polygon task = compounder.create_task( agent_id="agent_yield_001", protocol="aave_v3", chain="polygon", position_id="0xYourPositionId", compound_frequency="daily", reinvest_pct=95, # Keep 5% as gas reserve min_reward_usd=1.0, # Only if rewards > $1 (beat gas) gas_price_max_gwei=50 # Skip if gas > 50 gwei ) print(f"Task: {task['task_id']}") print(f"Est. gas/compound: ${task['estimated_gas_usd']:.4f}") print(f"Break-even reward: ${task['breakeven_reward_usd']:.2f}") # List active compound tasks tasks = compounder.list_tasks(agent_id="agent_yield_001") for t in tasks: print( f"{t['protocol']} on {t['chain']}: " f"earned=${t['total_earned_usd']:.2f} | " f"compounds={t['compound_count']}" )
Task Response
{
  "task_id": "comp_xyz789",
  "status": "active",
  "estimated_gas_usd": 0.0043,
  "breakeven_reward_usd": 0.09,
  "next_compound_at": "2026-03-04T18:00:00Z",
  "projected_apy_boost": 1.83
}
Gas-Aware Logic
The compounder evaluates gas conditions before every compound event. If gas spikes beyond your cap, the event is delayed until conditions normalize. You always compound at a positive expected value.
if gas_price > max_gwei: skip
if reward_usd < breakeven: skip
else: compound now

Supported Protocols

Six major DeFi protocols across lending, liquid staking, and liquidity provision.

๐Ÿฆ
Aave V3
Ethereum, Polygon, Arbitrum
5โ€“12% APY
๐Ÿ”ต
Compound
Ethereum, Base
4โ€“10% APY
๐ŸŒŠ
Lido
Ethereum (stETH)
3.5โ€“5% APY
๐Ÿš€
Rocket Pool
Ethereum (rETH)
3โ€“4.5% APY
๐Ÿฆ„
Uniswap V3
Ethereum, Polygon, Arbitrum
Variable
๐Ÿ“ˆ
Curve
Ethereum, Polygon
5โ€“20% APY

Compounder Performance

Gas-aware
Never compounds at a loss from gas costs
6+
DeFi protocols supported across 4 chains
Up to 20%
Effective APY boost from optimal compounding
Maximize Your Yield

Let Your Positions Compound While You Sleep

The yield compounder runs on Purple Flea's infrastructure โ€” no servers, no cron jobs, no missed compound windows. Set it once and let it run.

Get API Key Free โ†’