What is a Carry Trade in Crypto?
In traditional finance, carry trades involve borrowing a low-interest-rate currency (like the Japanese yen) and investing the proceeds in a high-interest-rate currency. The trade profits from the interest rate differential as long as the exchange rate remains stable.
In crypto, the equivalent differentials are abundant and volatile. Three main forms present themselves to AI agents:
- Funding rate carry: Perpetual futures markets pay or receive funding based on how far the perpetual price deviates from spot. A persistently positive funding rate means longs pay shorts — an agent can go short (or delta-neutral) and collect the funding payment.
- Stablecoin yield carry: Different lending protocols offer different annualized rates on USDC/USDT deposits. An agent can borrow at a low rate on one protocol and deposit at a higher rate on another.
- Cross-chain rate differentials: The same asset often yields differently across chains due to liquidity imbalances, protocol incentives, or bridge friction. An agent with multi-chain wallet capability can exploit these without needing to bridge manually.
Purple Flea's API provides all the execution primitives needed for the first and third forms: 275 perpetual markets for funding rate plays, and a 6-chain wallet API (ETH/BTC/SOL/TRX/XMR/XRP) for cross-chain positioning.
Form 1: Funding Rate Carry
Perpetual futures have no expiry date, so exchanges use a funding rate mechanism to keep the perpetual price anchored to spot. When the perpetual trades above spot (bullish sentiment), longs pay funding to shorts. When the perpetual trades below spot (bearish sentiment), shorts pay funding to longs.
Funding rates are paid every 8 hours on most venues. An annualized funding rate of 50% means longs pay 50% per year to maintain their position — or equivalently, shorts collect 50% per year on their notional. The carry trade opportunity is to go short the perpetual while hedging the price exposure (buying spot or another offsetting position), collecting the funding payment as pure yield.
Key insight: The carry is only risk-free if the delta is hedged. An unhedged short position that collects funding but loses on a 20% BTC rally is not a carry trade — it is a directional bet. True carry requires a delta-neutral position: short perp + long spot (or a correlated offsetting long).
Funding rate data from Purple Flea
Purple Flea's trading API exposes funding rates for all 275 markets. The scan below fetches all markets, computes the annualized funding rate, and ranks them by absolute carry opportunity:
import requests from dataclasses import dataclass from typing import List PF_KEY = "your_agent_api_key" HDR = {"X-API-Key": PF_KEY} BASE = "https://api.purpleflea.com" @dataclass class CarryOpportunity: market: str funding_rate_8h: float # e.g. 0.0035 = 0.35% per 8h funding_rate_ann: float # annualized: 8h * 3 * 365 open_interest_usd: float direction: str # "short_carry" or "long_carry" def scan_funding_rates(min_ann_rate: float = 0.20) -> List[CarryOpportunity]: """Scan all 275 Purple Flea markets for funding rate carry opportunities.""" resp = requests.get(f"{BASE}/trading/markets", headers=HDR) markets = resp.json().get("markets", []) opportunities = [] for m in markets: fr_8h = m.get("funding_rate", 0) fr_ann = fr_8h * 3 * 365 # 3 payments per day * 365 days if abs(fr_ann) >= min_ann_rate: opportunities.append(CarryOpportunity( market=m["symbol"], funding_rate_8h=fr_8h, funding_rate_ann=fr_ann, open_interest_usd=m.get("open_interest_usd", 0), direction="short_carry" if fr_8h > 0 else "long_carry" )) # Sort by absolute annualized rate descending return sorted(opportunities, key=lambda x: abs(x.funding_rate_ann), reverse=True) def execute_funding_carry(opp: CarryOpportunity, notional_usdc: float): """Open delta-neutral carry position: short perp + track hedge need.""" perp_side = "sell" if opp.direction == "short_carry" else "buy" # Size: notional / mark_price (simplified) mark = requests.get( f"{BASE}/trading/markets/{opp.market}", headers=HDR ).json().get("mark_price", 1) size = round(notional_usdc / mark, 4) order = requests.post(f"{BASE}/trading/order", headers=HDR, json={ "market": opp.market, "side": perp_side, "size": size, "type": "market" } ) return order.json() # --- Main carry agent logic --- if __name__ == "__main__": opps = scan_funding_rates(min_ann_rate=0.25) # 25%+ annualized for opp in opps[:3]: # top 3 opportunities print(f"{opp.market}: {opp.funding_rate_ann:.1%} ann | {opp.direction}") # Execute the best opportunity with $100 notional if opps: best = opps[0] result = execute_funding_carry(best, notional_usdc=100.0) print(f"Opened carry: {result}")
Form 2: Stablecoin Yield Carry
The second form of carry does not require any directional exposure at all. USDC lending rates vary significantly across DeFi protocols. When rate A is 8% and rate B is 3%, an agent that borrows at B and lends at A collects a 5% spread. The risk is protocol risk — if the lending protocol is exploited, the deposited USDC is lost.
For agents using Purple Flea, the relevant stablecoin carry is simpler: the agent holds USDC in its Purple Flea account and uses it for casino plays, trading, and escrow. The opportunity cost of that USDC is whatever the best risk-free stablecoin yield is elsewhere. An agent managing its USDC treasury should compute: expected return from Purple Flea activities vs. opportunity cost of idle USDC in a lending protocol.
| Activity | Expected Return | Risk Type | Recommended Allocation |
|---|---|---|---|
| Funding rate carry (short-perp) | 20–80% ann (varies) | Price gap risk, liquidation | 30% of capital |
| Casino strategies (coinflip/dice) | 0% EV (before house edge) | House edge ~1–2% | 10% of capital |
| Idle USDC in stablecoin lending | 5–12% ann (protocol) | Smart contract risk | 40% of capital |
| Trading capital reserve | Varies (trading PnL) | Market risk | 20% of capital |
Form 3: Cross-Chain Rate Differentials
The same asset can yield differently on different chains. A Solana-based lending protocol offering 9% on USDC while an Ethereum protocol offers 5% creates a 4% differential. Historically, human traders could not exploit this easily due to bridging friction and gas costs. An AI agent with a Purple Flea multi-chain wallet has native addresses on 6 chains and can hold assets across all of them without bridging complexity.
The cross-chain carry trade looks like this:
- Scan lending rates across chains (Ethereum, Solana, Tron, etc.)
- Identify the chain with the highest risk-adjusted stablecoin yield
- Route USDC to that chain's wallet via Purple Flea's wallet API
- Deposit to the high-yield protocol on that chain
- Rebalance monthly as rate differentials shift
Complete Carry Agent: Scanning and Executing All Three Forms
The following agent scans all three opportunity types, computes net profitability (after estimated fees), and executes the highest-returning opportunity:
import requests import time from dataclasses import dataclass, field from typing import List, Dict PF_KEY = "your_agent_api_key" HDR = {"X-API-Key": PF_KEY} BASE = "https://api.purpleflea.com" # Approximate cross-chain stablecoin yields (agent would fetch live) CHAIN_YIELDS: Dict[str, float] = { "ethereum": 0.055, # 5.5% ann on USDC (Aave) "solana": 0.088, # 8.8% ann on USDC (Kamino) "tron": 0.072, # 7.2% ann on USDT (JustLend) } @dataclass class CarryTrade: trade_type: str # "funding_carry" | "chain_carry" description: str net_annual_rate: float # after fees required_capital: float details: Dict = field(default_factory=dict) def scan_funding_carry() -> List[CarryTrade]: """Scan all Purple Flea perp markets for funding carry opportunities.""" markets = requests.get( f"{BASE}/trading/markets", headers=HDR).json().get("markets", []) trades = [] for m in markets: fr = m.get("funding_rate", 0) fr_ann = fr * 3 * 365 # Subtract estimated trading fees (0.04% per side = 0.08% round-trip) # And hedging cost (assume 0.02% to buy spot hedge) TAKER_FEE = 0.0008 HEDGE_COST = 0.0002 net_rate = abs(fr_ann) - (TAKER_FEE + HEDGE_COST) * 3 * 365 if net_rate > 0.15: # 15%+ net annualized only direction = "short" if fr > 0 else "long" trades.append(CarryTrade( trade_type="funding_carry", description=f"{direction} carry on {m['symbol']}", net_annual_rate=net_rate, required_capital=100.0, details={"market": m["symbol"], "direction": direction, "gross_rate": fr_ann} )) return trades def scan_chain_carry() -> List[CarryTrade]: """Find best cross-chain stablecoin yield differential.""" max_chain = max(CHAIN_YIELDS, key=lambda c: CHAIN_YIELDS[c]) min_chain = min(CHAIN_YIELDS, key=lambda c: CHAIN_YIELDS[c]) spread = CHAIN_YIELDS[max_chain] - CHAIN_YIELDS[min_chain] if spread > 0.02: # 2%+ differential required return [CarryTrade( trade_type="chain_carry", description=f"Deposit USDC on {max_chain} ({CHAIN_YIELDS[max_chain]:.1%} ann)", net_annual_rate=CHAIN_YIELDS[max_chain], required_capital=500.0, details={"chain": max_chain, "yield": CHAIN_YIELDS[max_chain]} )] return [] def run_carry_agent(): """Main agent loop: scan all forms, execute the best carry trade.""" all_opportunities: List[CarryTrade] = [] all_opportunities.extend(scan_funding_carry()) all_opportunities.extend(scan_chain_carry()) if not all_opportunities: print("No carry opportunities above threshold. Waiting...") return # Sort by net annual rate descending best = sorted(all_opportunities, key=lambda t: t.net_annual_rate, reverse=True)[0] print(f"\nBest carry opportunity:") print(f" Type: {best.trade_type}") print(f" Description: {best.description}") print(f" Net ann rate: {best.net_annual_rate:.1%}") if best.trade_type == "funding_carry": # Execute the funding rate carry on Purple Flea details = best.details size = round(best.required_capital / requests.get( f"{BASE}/trading/markets/{details['market']}", headers=HDR).json().get("mark_price", 50000), 5) result = requests.post(f"{BASE}/trading/order", headers=HDR, json={ "market": details["market"], "side": details["direction"], "size": size, "type": "market" } ).json() print(f" Executed: {result.get('order_id', 'error')}") elif best.trade_type == "chain_carry": # Get wallet address for the target chain chain = best.details["chain"] wallet = requests.get( f"{BASE}/wallets/{chain}", headers=HDR).json() print(f" Route {best.required_capital} USDC to {chain}: {wallet.get('address')}") if __name__ == "__main__": # Run carry agent every 4 hours (half of funding cycle) while True: run_carry_agent() time.sleep(14400) # 4 hours in seconds
Carry Trade Profitability: What to Expect
Carry trades in crypto can generate significantly higher returns than in traditional finance, but they come with crypto-specific risks that must be managed:
- Funding rate reversal: A market can shift from positive to negative funding rapidly, turning your short-carry position into a funding expense. Monitor funding rates every 8 hours and unwind quickly when the rate crosses zero.
- Hedge slippage: If you are running a delta-neutral funding carry (short perp + spot hedge), the spot leg needs to execute cleanly. On Purple Flea, the spot hedge can be executed via the wallet API or a separate spot order.
- Liquidation risk: The short perpetual position can be liquidated if the market moves sharply against you before the hedge kicks in. Use 2–3x maximum leverage to maintain sufficient liquidation buffer.
- Protocol risk (chain carry): DeFi lending protocols carry smart contract exploit risk. Diversify across protocols and chains rather than concentrating in one venue.
Practical tip: The best funding carry opportunities on Purple Flea's 275 markets tend to appear in mid-cap altcoin perps (LINK, AAVE, CRV, etc.) during trending markets. BTC and ETH have tighter, more efficiently priced funding rates. Check the top 20 markets by absolute funding rate daily, not just BTC and ETH.
Summary: Three Carry Strategies, One Agent
A well-architected carry agent uses all three forms simultaneously, allocating capital to the highest net-yield opportunity at any given time. When funding rates are flat, it shifts capital to chain carry yield. When a funding spike appears, it pivots to the delta-neutral carry. The agent in the code above does this automatically — scanning all three forms on each 4-hour cycle and executing the best available trade.
Purple Flea provides the execution primitives for all three: 275 perpetual markets with real-time funding data, a 6-chain wallet API for cross-chain positioning, and account management endpoints to track cumulative carry income over time.
Start carry trading with Purple Flea
Register an agent, claim $1 USDC from the faucet, and run the carry scanner. All 275 perpetual markets and 6-chain wallet API available from day one.
Register free →Related: Funding Rate Arbitrage Guide · Cross-Exchange Arbitrage for AI Agents · Purple Flea Trading API