Skip to main content

Overview

The Option Chains endpoints provide access to real-time options data including available expiration dates, complete option chains with Greeks, and market pricing.

Get Available Expirations

curl http://localhost:8000/api/options/expirations/AAPL
ticker
string
required
Stock ticker symbol (e.g., “AAPL”, “SPY”, “TSLA”)

Response

ticker
string
Ticker symbol in uppercase
spot_price
float
Current spot price of the underlying asset
risk_free_rate
float
Current risk-free interest rate used for calculations
expirations
array
List of all available expiration dates in YYYY-MM-DD format

Example Response

{
  "ticker": "AAPL",
  "spot_price": 175.43,
  "risk_free_rate": 0.05,
  "expirations": [
    "2024-12-20",
    "2024-12-27",
    "2025-01-03",
    "2025-01-17",
    "2025-02-21"
  ]
}
This endpoint is ultra-fast as it only queries the expiration list without downloading full option chains.

Get Option Chain

curl "http://localhost:8000/api/options/chain/AAPL?expiration=2024-12-20"
ticker
string
required
Stock ticker symbol
expiration
string
Expiration date in YYYY-MM-DD format. If not provided, uses the closest expiration >= 7 days out.

Response

ticker
string
Ticker symbol in uppercase
spot_price
float
Current spot price of the underlying
risk_free_rate
float
Risk-free rate used for Greeks calculations
expiration
string
The expiration date used for this chain
chain
object
Contains calls and puts arrays

Option Contract Fields

Each option contract (call or put) includes:
strike
float
Strike price of the option
bid
float
Current bid price
ask
float
Current ask price
mid
float
Mid price calculated as (bid + ask) / 2. Falls back to lastPrice if bid or ask is 0.
lastPrice
float
Last traded price
volume
integer
Trading volume
openInterest
integer
Open interest
impliedVolatility
float
Implied volatility (IV)
dte
integer
Days to expiration
type
string
Option type: “call” or “put”
expirationDate
string
Expiration date in ISO format

Greeks (Black-Scholes Calculated)

delta
float
Delta - Rate of change of option price with respect to underlying price
gamma
float
Gamma - Rate of change of delta
theta
float
Theta - Time decay per day
vega
float
Vega - Sensitivity to volatility changes

Example Response

{
  "ticker": "AAPL",
  "spot_price": 175.43,
  "risk_free_rate": 0.05,
  "expiration": "2024-12-20",
  "chain": {
    "calls": [
      {
        "strike": 170.0,
        "bid": 6.50,
        "ask": 6.70,
        "mid": 6.60,
        "lastPrice": 6.55,
        "volume": 1250,
        "openInterest": 3420,
        "impliedVolatility": 0.28,
        "dte": 45,
        "type": "call",
        "expirationDate": "2024-12-20",
        "delta": 0.65,
        "gamma": 0.035,
        "theta": -0.045,
        "vega": 0.12
      }
    ],
    "puts": [
      {
        "strike": 170.0,
        "bid": 2.10,
        "ask": 2.25,
        "mid": 2.175,
        "lastPrice": 2.15,
        "volume": 890,
        "openInterest": 2150,
        "impliedVolatility": 0.26,
        "dte": 45,
        "type": "put",
        "expirationDate": "2024-12-20",
        "delta": -0.35,
        "gamma": 0.035,
        "theta": -0.038,
        "vega": 0.11
      }
    ]
  }
}

Error Responses

404
error
No options found for the ticker
{
  "detail": "No options found for XYZ"
}
500
error
Internal server error during data fetching
{
  "detail": "Error message"
}

Implementation Notes

Greeks Calculation: All Greeks (delta, gamma, theta, vega) are calculated using the Black-Scholes-Merton model with:
  • Current spot price
  • Strike price
  • Time to expiration (in years)
  • Risk-free rate (currently 5%)
  • Implied volatility from market data
  • Dividend yield (q) = 0.0
Data Source: Options data is fetched from Yahoo Finance. Market hours and data availability may affect response times and data freshness.

Use Cases

  • Strategy Building: Fetch option chains to build multi-leg strategies
  • Greeks Analysis: Access calculated Greeks without separate computation
  • Liquidity Screening: Filter by volume and open interest
  • IV Analysis: Compare implied volatility across strikes

Build docs developers (and LLMs) love