DeFi protocols generate yield continuously. Optimal capital allocation requires constant monitoring across chains, real-time APY comparison, and millisecond execution. These are not tasks for humans — they are tasks for agents. This guide covers five production-ready strategies and the Purple Flea APIs that make them executable.
Decentralised finance is uniquely suited to autonomous agents for three structural reasons. First, protocols are permissionless API contracts — any entity with a wallet can call them, no KYC, no approval, no business hours. Second, the inefficiencies that generate alpha are temporary: APY differences between lending protocols, funding rate imbalances, and DEX price gaps exist for seconds to hours before arbitrageurs close them. Third, the execution is purely programmatic — smart contract calls, token approvals, and bridge transactions require no human interface.
A human DeFi participant can optimise one protocol at a time. An agent monitors dozens of protocols across multiple chains simultaneously, rebalances capital in real time, compounds yield at the mathematically optimal frequency, and hedges positions the moment risk thresholds are crossed. The strategies below represent the highest-return, most agent-friendly approaches in the current DeFi landscape.
All five strategies use the Purple Flea Wallet API for cross-chain capital movement and the Purple Flea Trading API for perpetual futures positions. The wallet provides a single address per chain without local key management; the trading API gives direct access to perpetual markets for hedging and funding rate collection.
Auto-compound across protocols
Uniswap v3 LP with IL monitoring
Collect perp funding, delta-neutral
Price gaps across DEXs and chains
USDC across Aave, Compound, Sky
Yield farming protocols offer APYs that shift hourly as liquidity enters and exits. A static
allocation optimised today may underperform by 40% within a week. An agent that continuously
compares APYs across Aave, Compound, Morpho, Yearn, and Convex — then reallocates capital
when the spread justifies the gas cost — captures the full yield curve rather than a snapshot.
Auto-compounding is the second lever. A 15% APY compounded daily becomes 16.2%
annually; compounded at the Kelly-optimal frequency (when compounding profit exceeds gas cost),
it maximises geometric growth. The agent calculates the break-even compound frequency and
triggers harvests only when profitable after gas.
Poll Aave, Compound, Morpho, Yearn, and Convex supply rates every 5 minutes. Maintain a ranked list of best risk-adjusted APY per asset. Trigger rebalance when the top protocol beats current allocation by more than the switching cost.
Track accrued rewards in real time. Harvest and reinvest when: reward_value_usd > gas_cost_usd * 3.
The 3x multiplier gives a safety margin for gas price spikes between calculation and execution.
Uniswap v3 concentrated liquidity positions earn fees proportional to volume within the
selected price range. The risk is impermanent loss (IL): if the price moves outside the
range, the position earns zero fees and holds a suboptimal token ratio. An agent monitors
positions continuously, adjusts ranges as prices trend, and calculates when accrued fees
exceed rebalancing cost.
The agent advantage: humans check LP positions daily or weekly. An agent
checks every few minutes and can narrow ranges for higher fee yield during high-volume
windows, or widen ranges before anticipated high-volatility events to reduce rebalance costs.
Perpetual futures markets pay a periodic funding rate between long and short position holders.
When longs dominate (typical in bull markets), shorts receive funding. The strategy is
delta-neutral: hold spot ETH (long) and an equal short perpetual position, earning funding
on the short without directional exposure. Annualised yields during high-sentiment periods
reach 20-60%.
The Purple Flea Trading API provides direct access to perpetual positions.
The wallet API holds the spot collateral. The agent opens the hedge when funding rate exceeds
a threshold and closes it when the rate compresses, keeping capital deployed only when the
yield justifies the execution and counterparty risk.
The same token can trade at different prices across chains and DEXs simultaneously.
ETH on Uniswap (Ethereum) vs Uniswap (Arbitrum), USDC on Curve (Ethereum) vs Curve (Optimism),
or BTC between Wrapped BTC implementations. Bridging costs and time are the limiting factors.
An agent calculates net profit after bridge fees and gas, and executes only when the spread
exceeds a profitability threshold.
The Purple Flea Wallet swap API handles cross-chain bridge execution as a
single API call, abstracting the underlying bridge protocol selection and routing.
USDC and USDT lending rates across Aave, Compound, Sky (formerly MakerDAO), and Euler
diverge constantly as utilisation rates change with market demand. The stablecoin yield
maximizer holds no directional risk — it is pure rate arbitrage between lending protocols.
With $100,000 deployed, even a 2% APY spread captured continuously represents $2,000
annually in additional yield from just rebalancing.
The strategy pairs naturally with the yield farming optimizer from Strategy 1
but deserves its own focus because stablecoins have a distinct risk profile: no IL,
no price risk, minimal smart contract complexity. The main risks are protocol insolvency
and smart contract bugs — manage with protocol concentration limits.
A DeFi agent running multiple strategies simultaneously must manage a portfolio of risks, not individual position risks. The rules below apply to the combined portfolio.
assert portfolio_value > stop_loss_usd
before every trade. If it fails, the agent halts and alerts.
One wallet, one trading account, and one API key connect your agent to every strategy described above — across Ethereum, Arbitrum, Optimism, Base, and Solana.
The Purple Flea Wallet API handles every on-chain operation in this guide: token swaps, DEX interactions, bridge execution, protocol deposits and withdrawals, LP management, and smart contract calls.
Used exclusively in Strategy 3 (funding rate harvesting) and optionally to hedge delta exposure from LP positions. Provides market and limit orders, position management, funding rate data, and P&L tracking for perpetual futures.
Every wallet operation is authenticated with your API key. Private keys are stored in Purple Flea HSMs — never in your agent's memory, disk, or environment variables. If your agent is compromised, the attacker has your API key scope, not your private key.
Ethereum, Arbitrum, Optimism, Base, Solana — all exposed through the same endpoints.
Your agent does not need chain-specific libraries or RPC node management. Specify
chain: "arbitrum" and the API routes correctly.
Onboard other DeFi agents to Purple Flea and earn 10-20% of their transaction fees indefinitely. An agent that operates at $1M+ volume and onboards five similar agents generates significant passive referral income on top of DeFi yield.
Purple Flea's agent referral program pays 10-20% of all fees generated by agents you introduce — in perpetuity. A DeFi yield farming agent running $500,000 in capital generates roughly $2,500-5,000 in annual API fees depending on rebalance frequency. Referring one such agent earns you $250-$1,000 per year passively.
If your DeFi agent communicates with other agents (for example, a portfolio management agent that spawns strategy sub-agents), you can build the referral link directly into the agent's onboarding flow: any agent that creates a wallet using your referral code generates passive income for your primary agent without any human intervention.
Create a Purple Flea wallet and trading account. Connect to Aave, Uniswap, and perpetual markets through a single API — no local key management, no RPC nodes, no chain-specific code.