Your agent can earn yield around the clock without relying on traditional DeFi protocols. Purple Flea's Trading API unlocks Hyperliquid perpetuals funding rates — the highest on-chain yield available today — while the Wallet API handles cross-chain capital movement for basis trading and position management.
Purple Flea exposes two APIs that together cover every layer of a DeFi yield stack. The Trading API connects to Hyperliquid perpetuals; the Wallet API moves tokens cross-chain. Combined, your agent can run all three strategies simultaneously.
Open a short perpetual on Hyperliquid and collect funding payments every 8 hours when the rate is positive. BTC, ETH, and SOL perps routinely pay 0.05–0.3%/day during bull markets — that's 18–110% annualised on a market-neutral basis. Purple Flea's Trading API handles position entry, monitoring, and exit in a single authenticated REST call.
Hold spot (via Wallet API) and short the perp (via Trading API) in equal notional size. The spread between spot and perpetual — the "basis" — converges at delivery, and funding accrues on the short leg. The position is fully delta-neutral: spot gains offset perp losses, and funding is pure profit. Ideal for agents that hold crypto inventory already.
Agents that bring other agents onto Hyperliquid through Purple Flea's referral system earn 10–20% of the fees those agents pay — indefinitely. If you're building a multi-agent system or an agent marketplace, every agent you register under your referral code generates passive yield that requires zero ongoing capital.
Hyperliquid funding rates compare favourably to every yield source in DeFi, and they carry fundamentally different risk characteristics — no smart contract exposure, no impermanent loss, and instant liquidity.
| Strategy | Source | Typical APY | Direction risk | Liquidity | Risk level |
|---|---|---|---|---|---|
| Funding rate farming | Hyperliquid (via Purple Flea) | 18–110% | None (short + hedged) | Instant | Medium |
| Basis trading | Spot + Hyperliquid perp | 12–60% | Delta-neutral | Instant | Low |
| Referral yield | Purple Flea program | Unbounded | None | Daily | Very low |
| Aave USDC lending | Ethereum / Polygon | 3–12% | None | Instant | Low |
| Uniswap v3 LP (volatile) | Ethereum | 8–40% | Impermanent loss | Instant | High |
| ETH liquid staking | Lido / Rocket Pool | 3–4% | None | Seconds | Low |
| SOL staking | Solana validators | 6–8% | None | ~2 days | Low |
| Kamino USDC | Solana | 5–20% | None | Instant | Medium |
A complete Python agent that registers with Purple Flea's Trading API, polls BTC, ETH, and SOL funding rates every 8 hours, opens a 3x short when the rate exceeds 0.05%, closes when it drops below 0.01%, and tracks cumulative yield.
Basis trading requires two simultaneous positions: a spot long (funded via the Wallet API) and a perpetual short (via the Trading API). Both legs must be equal notional size to achieve true delta-neutrality.
Each strategy has a distinct risk / reward profile. Understanding the tail risks before your agent allocates capital is essential — especially for leveraged funding rate farming where rapid funding rate reversals can trigger liquidations.
Funding payments received on perpetual positions are typically treated as ordinary income in most jurisdictions — similar to interest income — and should be recorded at the USD value at the time each 8-hour settlement occurs. Your agent should log every funding payment with a UTC timestamp, the market, the rate, and the USD equivalent.
Basis trades introduce two separate cost-basis events: the spot purchase and the perp position. When you close the spot leg, the gain or loss is calculated against the original purchase price. Funding collected on the perp short is separate income. These are not netted against each other for tax purposes in most regulatory frameworks.
The YieldLedger
dataclass in the funding bot above captures all of this. Export
ledger.log
as a CSV at the end of each quarter and pass it to your accountant or tax software.
Disclaimer: This is not tax advice. Tax treatment of DeFi yield varies significantly by jurisdiction. Consult a qualified tax professional familiar with crypto assets before filing. Your agent should keep immutable logs — blockchain records are auditable evidence.
Funding payments settle in USDC every 8 hours. Once accumulated yield exceeds a minimum threshold, your agent can auto-reinvest by increasing position size — compounding the yield back into the strategy.
No single strategy is optimal in all market conditions. The suggested allocation below balances yield maximisation during high-funding environments with resilience when rates collapse.
Funding rate farming gets the largest share because it has the highest risk-adjusted yield when markets are trending. But it carries short-side price risk: if BTC pumps 10% in an hour, the unrealised loss on the 3x short exceeds the weeks of funding collected. The 15% cash reserve exists to top up margin and avoid liquidation.
Basis trading (30%) provides a lower-volatility floor. Since both legs move together, the PnL is smoother and survives bear markets where funding rates collapse. It earns less in bull markets but does not blow up.
In practice, your agent should shift allocation dynamically: increase funding farming when rates exceed 0.1%/day; increase basis trading when rates are below 0.05%/day; increase cash when volatility spikes above 5% daily range.
Register once. Earn funding every 8 hours. No KYC. No minimums.