Building an Options Chain Analyzer: Fetching Calls, Puts, and Greeks as JSON

An options chain is a big table. Every strike, every expiration, calls on one side and puts on the other, plus bid, ask, volume, open interest, implied volatility and the Greeks. Looking at it in a browser is easy. Analyzing it in code is the hard part.

The usual route is a scraper, and it breaks. The page changes, the table loads in pieces, and you end up parsing HTML to get a delta value. Or you pay for a market-data feed that costs more than your whole project.

SteadyAPI returns one expiration of the chain as JSON, with the Greeks included, and tells you which other expirations exist. In this guide you will list expirations, load a chain into pandas, and run a few checks: put/call ratios, the contracts nearest the money, and a liquidity filter.

If you only need the raw chain, see the short walkthrough. This post goes further and analyzes the data.

Prerequisites

  • A SteadyAPI account and API key from steadyapi.com. The Free plan excludes the Options Data API, so you need a paid plan (Starter and up).
  • Python 3.8+ with requests and pandas.
  • Basic familiarity with calls, puts and strikes.

The endpoint

GET https://api.steadyapi.com/v3/markets/options

It returns the chain for one expiration, grouped into Call and Put lists sorted by strike. The endpoint has a weight of 2.

  • ticker (required): a stock, ETF or index. Prefix indexes with $ or ^, for example $SPX. symbol also works.
  • expiration (optional): a date in YYYY-MM-DD format. Without it, you get this week's Friday, or next Friday once this week's has passed. If no chain exists for that date, you get the nearest listed expiration.

meta.expirations lists every available date, split into weekly and monthly. Each contract carries bid, ask, midpoint, last price, volume, open interest, implied volatility, delta, theta, vega, moneyness and days to expiration. The docs also list rho. Copy the exact request for your language from the endpoint docs.


Step 1: Fetch a chain and list expirations

The first call without expiration already gives you a chain, plus the expiration list. Use both.

import requests
import pandas as pd

API_KEY = "YOUR_STEADYAPI_KEY"
URL = "https://api.steadyapi.com/v3/markets/options"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}


def fetch_chain(ticker, expiration=None):
    params = {"ticker": ticker}
    if expiration:
        params["expiration"] = expiration
    r = requests.get(URL, headers=HEADERS, params=params, timeout=30)
    r.raise_for_status()
    data = r.json()
    if data.get("success") is False:
        raise RuntimeError(data.get("message", "Request failed"))
    return data


data = fetch_chain("SPY")
expirations = data["meta"]["expirations"]
print("Weekly:", expirations["weekly"][:5])
print("Monthly:", expirations["monthly"][:3])

The body object has two lists. A trimmed call contract looks like this, with values from the docs sample:

{
  "symbol": "SPY|20250530|590.00C",
  "strikePrice": "590.00",
  "expirationDate": "05/30/25",
  "moneyness": "+0.19%",
  "bidPrice": "4.96",
  "askPrice": "4.98",
  "lastPrice": "5.00",
  "volume": "39,945",
  "openInterest": "30,435",
  "openInterestChange": "+2,108",
  "volatility": "20.08%",
  "delta": "0.5518",
  "vega": "0.2120",
  "theta": "-0.7369",
  "daysToExpiration": "3",
  "optionType": "Call"
}

Every value is a string. Some carry commas, signs or percent signs. Convert them before you do any math.


Step 2: Flatten the chain into DataFrames

def num(value):
    """'39,945' -> 39945.0, '+0.19%' -> 0.19, 'N/A' -> None."""
    try:
        return float(str(value).replace(",", "").replace("%", "").replace("+", ""))
    except ValueError:
        return None


COLS = ["strikePrice", "bidPrice", "askPrice", "lastPrice", "volume",
        "openInterest", "volatility", "delta", "theta", "vega",
        "moneyness", "daysToExpiration"]


def to_df(rows):
    df = pd.DataFrame(rows)
    for c in COLS:
        df[c] = df[c].map(num)
    return df[COLS]


calls = to_df(data["body"]["Call"])
puts = to_df(data["body"]["Put"])

# One row per strike, calls and puts side by side
chain = calls.merge(puts, on="strikePrice", suffixes=("_call", "_put"))

Pulling a different expiration is one more call, for example fetch_chain("SPY", "2025-06-20").


Step 3: Run the checks

Put/call ratios. Compare puts to calls by open interest and by volume.

pcr_oi = puts["openInterest"].sum() / calls["openInterest"].sum()
pcr_vol = puts["volume"].sum() / calls["volume"].sum()
print(f"Put/call ratio  OI: {pcr_oi:.2f}  volume: {pcr_vol:.2f}")

Contracts nearest the money. moneyness shows how far the underlying is from each strike. The smallest absolute value is the at-the-money contract.

atm = calls.loc[calls["moneyness"].abs().idxmin()]
print(f'ATM call strike {atm.strikePrice}: delta {atm.delta}, '
      f'theta {atm.theta}, vega {atm.vega}, IV {atm.volatility}%')

Heaviest strikes. Where is open interest piled up?

print(calls.nlargest(5, "openInterest")[["strikePrice", "openInterest", "volume"]])
print(puts.nlargest(5, "openInterest")[["strikePrice", "openInterest", "volume"]])

Liquidity filter. A contract with a wide spread is hard to trade. Drop those before you rank anything.

calls["spread_pct"] = (calls["askPrice"] - calls["bidPrice"]) / calls["askPrice"] * 100
liquid = calls[(calls["openInterest"] >= 500) & (calls["spread_pct"] <= 10)]
print(liquid[["strikePrice", "delta", "volatility", "spread_pct"]].head(10))

Best practices

  • Reuse your first response. The call without expiration returns a chain and the expiration list. Cache the list, and request only the expirations you need. Each call has a weight of 2, so a full term structure adds up.
  • Parse everything. Strings with commas, signs and N/A will break a plain float(). Keep one helper and use it everywhere.
  • Handle errors by status and by body. A 403 means your plan does not include options. A failed lookup can come back as JSON with success set to false. Check both. Only 200 responses count toward your quota.
  • Use the Greeks as provided. Do not recompute delta from the quoted IV. Use what the API returns, and treat empty values as missing.
  • Mind the rate limit. The standard limit is 10 requests per second per account. Loop expirations one after another.

Bonus: ask it in plain English

You can connect Claude Code, Cursor, VS Code, or any MCP client to https://api.steadyapi.com/mcp with your API key. Then you can ask for "SPY's put/call open-interest ratio for the next monthly expiration" in chat and skip the script for one-off questions.


Conclusion

You listed expirations, loaded a full options chain into pandas, and ran put/call ratio, at-the-money, open-interest and liquidity checks on it.

Create a free account at steadyapi.com (no card required), upgrade to a paid plan to use options data, and read the API documentation for every parameter and ready-made examples in cURL, JavaScript, PHP, and Python.