# Options Volatility Analysis, Smile & Term Structure (`khnaami/options-volatility-analysis-smile-term-structure`) Actor

Quantitative options volatility suite: ATM Implied Volatility, 30D Realized Volatility, 52W IV Rank/Percentile, Variance Risk Premium (VRP), Volatility Smile, Term Structure (Contango/Backwardation), Skew & Kurtosis.

- **URL**: https://apify.com/khnaami/options-volatility-analysis-smile-term-structure.md
- **Developed by:** [khalid naami](https://apify.com/khnaami) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Options Volatility Analysis, Smile & Term Structure 📊🌊

**Options Volatility Analysis, Smile & Term Structure** is an institutional quantitative options volatility Actor on Apify. It extracts real-time options chains, models At-The-Money Implied Volatility (ATM IV), 30-Day Historical Realized Volatility (RV), 52-Week IV Rank and IV Percentile, Variance Risk Premium (VRP), strike-by-strike Volatility Smiles, forward Term Structures (Contango vs Backwardation), option Skewness & Kurtosis tail risk, and market-implied Expected Move cones.

***

### 🌟 Key Features

1. **Core Volatility 5-Pack Metrics:**
   - **ATM Implied Volatility (IV %):** Midpoint of At-The-Money Call and Put IV.
   - **30-Day Realized Volatility (RV %):** $\text{std}(\text{log returns}) \times \sqrt{252} \times 100$.
   - **VIX Benchmark Proxy:** Automated asset volatility index mapping (`SPY -> ^VIX`, `QQQ -> ^VXN`, `IWM -> ^RVX`, `AAPL -> ^VXAPL`, `NVDA -> ^VXNVD`, `TSLA -> ^VXTSL`).
   - **52-Week IV Rank & Percentile:** Relative position of current volatility within its 1-year historical range.
   - **Variance Risk Premium (VRP):** $\text{IV} - \text{RV}$ (identifies whether options are overvalued or undervalued).

2. **Strike-by-Strike Volatility Smile & Skew Curve:**
   - Detailed strike-by-strike Call IV and Put IV curve across the active expiration cycle ($0.8 \times S$ to $1.2 \times S$).

3. **IV Term Structure Matrix (Contango vs Backwardation):**
   - ATM IV curve across all future expiration dates (DTE 1 to 365+ days).
   - Automated regime classification: `Normal Contango`, `Inverted Backwardation`, or `Flat Volatility Curve`.

4. **Option Skewness & Kurtosis (Tail Risk):**
   - **Skewness Ratio:** $\frac{\text{IV}*{\text{OTM Put}} - \text{IV}*{\text{OTM Call}}}{\text{IV}\_{\text{ATM}}}$.
   - **Kurtosis (Fat Tails):** $\frac{\text{IV}*{\text{OTM Put}} + \text{IV}*{\text{OTM Call}} - 2 \times \text{IV}*{\text{ATM}}}{\text{IV}*{\text{ATM}}}$.

5. **Options Market-Implied Expected Move Cone:**
   - Upper and Lower price bounds derived from ATM Straddle pricing across the nearest 4 expiration cycles: $\pm 0.85 \times (\text{Call}*{\text{mid}} + \text{Put}*{\text{mid}})$.

6. **1-Year Historical IV vs RV Timeseries:**
   - Daily 1-year time series tracking Historical Realized Volatility, Benchmark VIX, and Rolling IV Rank.

***

### 📥 Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `symbols` | `array` | `["SPY", "QQQ", "AAPL", "NVDA", "TSLA"]` | List of tickers to calculate full volatility diagnostics for. |
| `includeSmileCurve` | `boolean` | `true` | Calculate strike-by-strike Call and Put Implied Volatility curves. |
| `includeTermStructure` | `boolean` | `true` | Calculate ATM IV term structure across future expiration cycles. |
| `includeHistoricalVol` | `boolean` | `true` | Include 1-year daily history of Realized Volatility and VIX proxy. |
| `includeExpectedMoveCone` | `boolean` | `true` | Compute market-implied upper/lower expected move bounds. |
| `maxExpirationsToScan` | `integer` | `15` | Maximum forward expiration cycles to scan (3–30). |

***

### 📤 Output Schema

```json
{
  "symbol": "NVDA",
  "underlyingPrice": 128.45,
  "selectedExpiry": "2026-10-16",
  "currentAtmIvPct": 46.85,
  "currentRv30dPct": 38.20,
  "vixProxyTicker": "^VXNVD",
  "vixProxyValue": 45.90,
  "ivRank52wPct": 62.4,
  "ivPercentile52wPct": 68.0,
  "vrpSpread": 8.65,
  "termStructureRegime": "Normal Contango 📈 (Front Month < Back Month)",
  "skewnessRatio": 0.1450,
  "kurtosisFatTail": 0.0920,
  "expectedMoveNearest1Pct": 4.15,
  "volatilityGrade": "ELEVATED IV / RICH PREMIUM 🟢 (Net Credit Strategies Favorable)",
  "volatilitySmileCurve": [ ... ],
  "termStructureMatrix": [ ... ],
  "expectedMoveProjections": [ ... ],
  "historicalVolTimeSeries": [ ... ]
}
```

***

### 🚀 Local Run

```bash
uv run --with apify --with pandas --with numpy --with scipy --with yfinance --with requests --with pytz --with python-dateutil python -m src.main
```

# Actor input Schema

## `symbols` (type: `array`):

List of tickers or optionable equities/indices to calculate full volatility diagnostics for (e.g. SPY, QQQ, AAPL, NVDA, TSLA, MSFT, AMZN).

## `includeSmileCurve` (type: `boolean`):

Calculate strike-by-strike Call and Put Implied Volatility curves across the nearest expiration.

## `includeTermStructure` (type: `boolean`):

Calculate ATM IV term structure across all future expiration cycles and classify Contango vs Backwardation.

## `includeHistoricalVol` (type: `boolean`):

Include daily 1-year history of 30-day Realized Volatility, VIX benchmark, and underlying price.

## `includeExpectedMoveCone` (type: `boolean`):

Calculate market-implied upper and lower expected move bounds from ATM straddles across nearest 4 expiration cycles.

## `maxExpirationsToScan` (type: `integer`):

Maximum number of forward expiration cycles to process in the term structure matrix.

## Actor input object example

```json
{
  "symbols": [
    "SPY",
    "QQQ",
    "AAPL",
    "NVDA",
    "TSLA"
  ],
  "includeSmileCurve": true,
  "includeTermStructure": true,
  "includeHistoricalVol": true,
  "includeExpectedMoveCone": true,
  "maxExpirationsToScan": 15
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items and records produced by the Actor

## `overview` (type: `string`):

Summary report stored in Key-Value store

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "symbols": [
        "SPY",
        "QQQ",
        "AAPL",
        "NVDA",
        "TSLA"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("khnaami/options-volatility-analysis-smile-term-structure").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "symbols": [
        "SPY",
        "QQQ",
        "AAPL",
        "NVDA",
        "TSLA",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("khnaami/options-volatility-analysis-smile-term-structure").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "symbols": [
    "SPY",
    "QQQ",
    "AAPL",
    "NVDA",
    "TSLA"
  ]
}' |
apify call khnaami/options-volatility-analysis-smile-term-structure --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khnaami/options-volatility-analysis-smile-term-structure"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/UMDfsgvj8vQcGSwYe/builds/WiAMqYdq6eu6e0ICf/openapi.json
