Calls & Puts · Deribit · Lyra Finance

Crypto Options API for AI Agents

Give your AI agent asymmetric exposure to crypto markets. Buy BTC and ETH calls and puts, construct multi-leg spreads, manage Greeks, and hedge portfolio delta — all via a single unified API connecting Deribit and DeFi options protocols.

Why Options Give AI Agents an Asymmetric Edge

Spot trading and perpetual futures expose agents to unlimited loss on the wrong side of a move. Options change the payoff structure fundamentally: a long option has a defined maximum loss (the premium paid) but retains theoretically unlimited upside on calls, or near-total downside protection on puts.

For AI agents managing portfolios, options serve three core functions. First, hedging — buying puts against long crypto holdings limits downside during volatile periods without requiring the agent to sell its positions. Second, yield enhancement — selling covered calls against held ETH generates premium income in sideways markets. Third, volatility trading — selling straddles when implied volatility is elevated harvests the volatility risk premium.

Purple Flea gives agents a unified interface to all major crypto options venues: Deribit for deep liquidity on BTC and ETH, and Lyra Finance plus Premia for on-chain, non-custodial options trading — critical for agents that cannot hold funds on centralized exchanges.

🏭
CENTRALIZED

Deribit

The world's largest crypto options exchange by open interest. BTC and ETH options with strikes spanning from far out-of-the-money to deep in-the-money, weekly through quarterly expiries. European-style. Highest liquidity, tightest bid-ask spreads.

🌈
DEFI

Lyra Finance

On-chain options protocol on Arbitrum and Optimism. AMM-based pricing means agents always have a price to trade against — no order book, no waiting for a counterparty. ETH and BTC options with automated hedging by the protocol.

💰
DEFI

Premia

Peer-to-pool options protocol supporting a wide range of ERC-20 tokens beyond BTC and ETH. Useful for agents that need options on altcoins or want non-custodial options settlement without an exchange account.

Supported Instruments and Expiries

Purple Flea's options API covers the full options chain across all major expiry cycles. Agents can access real-time pricing, implied volatility surfaces, and Greeks for every listed strike and expiry.

Underlying Option Types Expiry Cycles Style Exchange
BTC Calls + Puts Weekly, Monthly, Quarterly European Deribit
ETH Calls + Puts Weekly, Monthly, Quarterly European Deribit + Lyra
ETH Calls + Puts Custom (up to 90 days) European Premia
ERC-20 Altcoins Calls + Puts Custom European Premia

Options API Code Examples

Get full ETH options chain JavaScript
import PurpleFlea from "@purpleflea/sdk";

const pf = new PurpleFlea({ apiKey: process.env.PURPLEFLEA_API_KEY });

// Get full ETH options chain from Deribit
const chain = await pf.options.getChain({
  underlying: "ETH",
  exchange: "deribit",
  expiry: "2025-03-28",  // or "nearest-weekly", "nearest-monthly"
});

// chain.calls: array of call options sorted by strike
// chain.puts:  array of put options sorted by strike
for (const call of chain.calls) {
  console.log(
    `Strike: ${call.strike}`,
    `IV: ${(call.impliedVol * 100).toFixed(1)}%`,
    `Delta: ${call.delta.toFixed(3)}`,
    `Bid: ${call.bid}  Ask: ${call.ask}`,
  );
}

// Find ATM call (closest to current spot)
const spot = await pf.getPrice("ETH");
const atmCall = chain.calls.reduce((a, b) =>
  Math.abs(a.strike - spot) < Math.abs(b.strike - spot) ? a : b
);
console.log(`ATM Call: ${atmCall.strike} strike, ${(atmCall.impliedVol * 100).toFixed(1)}% IV`);
Buy ATM ETH call option JavaScript
// Buy 1 ATM ETH call expiring this Friday
const order = await pf.options.buy({
  underlying: "ETH",
  type: "call",
  exchange: "deribit",
  strike: atmCall.strike,
  expiry: "2025-03-28",
  contracts: 1,             // 1 contract = 1 ETH on Deribit
  orderType: "limit",
  limitPrice: atmCall.ask,   // pay the ask for immediate fill
});

console.log(`Order filled: ${order.filledContracts} contracts`);
console.log(`Premium paid: ${order.premiumPaid} ETH`);
console.log(`Position delta: ${order.positionDelta}`);
console.log(`Break-even at expiry: $${order.breakEven}`);
Construct a bull call spread JavaScript
// Bull call spread: buy lower strike call, sell higher strike call
// Reduces premium cost, caps maximum profit
const spread = await pf.options.constructSpread({
  type: "bull-call-spread",
  underlying: "ETH",
  exchange: "deribit",
  expiry: "2025-03-28",
  lowerStrike: 3000,   // buy this call
  upperStrike: 3500,   // sell this call
  contracts: 1,
});

console.log(`Net premium: ${spread.netPremium} ETH`);
console.log(`Max profit:  ${spread.maxProfit} ETH (at or above $3500)`);
console.log(`Max loss:    ${spread.maxLoss} ETH (at or below $3000)`);
console.log(`Break-even:  $${spread.breakEven}`);

// Execute the spread as a combo order
await spread.execute();
Hedge portfolio delta with ETH puts JavaScript
// Portfolio hedging: buy ETH puts when portfolio delta is too high
async function hedgePortfolio(targetDelta = 0.5) {
  const portfolio = await pf.getPortfolio();
  const currentDelta = portfolio.totalDelta; // e.g., 1.2 (too long)

  if (currentDelta <= targetDelta) return; // no hedge needed

  const deltaToHedge = currentDelta - targetDelta; // 0.7

  // Find put with delta closest to -deltaToHedge
  const chain = await pf.options.getChain({
    underlying: "ETH",
    exchange: "deribit",
    expiry: "nearest-monthly",
  });

  const targetPut = chain.puts.reduce((a, b) =>
    Math.abs(Math.abs(a.delta) - deltaToHedge) <
    Math.abs(Math.abs(b.delta) - deltaToHedge) ? a : b
  );

  console.log(`Buying ETH put strike $${targetPut.strike}, delta ${targetPut.delta}`);

  await pf.options.buy({
    underlying: "ETH",
    type: "put",
    exchange: "deribit",
    strike: targetPut.strike,
    expiry: "nearest-monthly",
    contracts: 1,
    orderType: "market",
  });
}

Agent Options Use Cases

1. Portfolio Hedging Agent

A portfolio management agent that holds 10 ETH buys monthly ETH puts when its portfolio delta exceeds 1.0. The puts provide downside protection during sharp market declines without requiring the agent to liquidate its spot holdings. When implied volatility spikes (as it typically does during drawdowns), the puts increase in value, partially offsetting portfolio losses.

The agent rolls the hedge monthly, buying new puts when old ones expire. It dynamically adjusts the strike selection based on current IV levels — choosing further out-of-the-money puts when IV is low (cheaper premium) and closer to at-the-money puts during high-IV periods.

2. Volatility Trading Agent

Crypto implied volatility is systematically elevated compared to realized volatility, meaning options sellers collect more premium on average than they pay out. A volatility trading agent monitors the implied volatility surface, identifies when IV is in the top quartile of its 30-day range, and sells straddles (simultaneous ATM call + ATM put sale) to harvest the volatility risk premium.

The agent maintains delta-neutral positioning by dynamically hedging with spot, keeping its directional exposure near zero while the options premium decays. Positions are closed when IV reverts to the mean or when the position reaches 50% of maximum profit.

3. Yield Enhancement via Covered Calls

An agent holding BTC or ETH can sell monthly out-of-the-money calls against its holdings to generate premium income in sideways markets. If the price stays below the strike at expiry, the agent keeps the full premium. If the price exceeds the strike, the agent delivers its held tokens at the strike price — effectively selling at a level it was comfortable with anyway.

At 0.5% IV per week on a $100K ETH position, covered call writing generates approximately $26,000/year in premium income with no directional assumption required.

Options Greeks Reference for AI Agents

Greeks measure how an option's price changes in response to different market factors. Understanding Greeks is essential for any agent managing options positions.

Greek Symbol Range What it Measures Agent Relevance
Delta Δ 0 to 1 (calls)
-1 to 0 (puts)
Price sensitivity to $1 move in underlying An ATM call has delta ~0.5 — the option price moves $0.50 for every $1 move in ETH. Agents use delta to calculate total portfolio directional exposure and hedge accordingly.
Gamma Γ 0 to positive Rate of change of delta per $1 move High gamma near expiry means delta changes rapidly. Agents must re-hedge more frequently when gamma is high. Long options have positive gamma (accelerating gains).
Theta Θ Negative (long)
Positive (short)
Daily time decay of the option's value An option losing $50/day in theta costs the long holder $350/week simply from time passing. Agents selling options collect positive theta; buyers pay it. Theta accelerates as expiry approaches.
Vega ν Positive (long)
Negative (short)
Price change per 1% change in implied volatility Long options gain when IV rises; short options lose. Agents selling straddles for volatility income have negative vega — they want IV to fall after entering the trade. Hedging vega involves offsetting long and short options positions.
Query Greeks for a position JavaScript
// Get Greeks for the current options positions
const positions = await pf.options.getPositions();
const portfolioGreeks = pf.options.aggregateGreeks(positions);

console.log(`Portfolio Delta: ${portfolioGreeks.delta.toFixed(3)}`);
console.log(`Portfolio Gamma: ${portfolioGreeks.gamma.toFixed(4)}`);
console.log(`Portfolio Theta: -$${Math.abs(portfolioGreeks.theta).toFixed(2)}/day`);
console.log(`Portfolio Vega:  ${portfolioGreeks.vega.toFixed(2)} per 1% IV move`);

// Hedge delta if it drifts too far
if (Math.abs(portfolioGreeks.delta) > 0.3) {
  // Reduce delta exposure with a spot hedge
  const hedgeAmount = portfolioGreeks.delta * spotPrice;
  console.log(`Hedging $${hedgeAmount.toFixed(0)} of ETH to flatten delta`);
}

Risk note: Options involve leverage and can expire worthless. AI agents trading options should implement position sizing rules (never risk more than 2-5% of capital per options position) and maintain sufficient collateral for short options positions. Purple Flea's bankroll management API integrates directly with options positions for automated risk controls.

Common Options Strategies for Agents

Strategy Structure Market View Max Profit Max Loss
Long Call Buy call Bullish Unlimited Premium paid
Long Put Buy put Bearish / hedge Strike − premium Premium paid
Bull Call Spread Buy lower call, sell higher call Moderately bullish Strike diff − net premium Net premium
Covered Call Hold underlying + sell call Neutral / mildly bullish Call premium + upside to strike Full underlying loss less premium
Straddle (short) Sell ATM call + sell ATM put Low volatility expected Total premium collected Unlimited on both sides
Iron Condor Bull put spread + bear call spread Range-bound market Net premium collected Width of spread − premium

Related Purple Flea APIs

Options integrate with Purple Flea's full suite of trading and risk management tools.