# Options Max Pain & Gamma Exposure (GEX) Levels (`scrapemint/options-max-pain-gamma-exposure`) Actor

Max pain, gamma exposure (GEX), gamma flip, call wall and put wall for any US stock, ETF or index (SPX, SPY, QQQ, TSLA...) per expiry and across expiries, plus put/call ratios. Cboe delayed data, no API key.

- **URL**: https://apify.com/scrapemint/options-max-pain-gamma-exposure.md
- **Developed by:** [Ken M](https://apify.com/scrapemint) (community)
- **Categories:** Business, News
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.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 Max Pain & Gamma Exposure (GEX) Levels

Get the levels options traders watch for any US stock, ETF or index: max pain, net gamma exposure (GEX), the gamma flip, the call wall and the put wall, and put/call ratios. Each symbol gets one row across all selected expiries plus one row per expiry, computed from the full Cboe option chain.

Works for SPX, SPY, QQQ, NDX, RUT, VIX and every optionable US stock. Cboe delayed data (about 15 minutes), no API key, no login.

### Who uses it

- **0DTE and short-dated traders**: where dealers are long or short gamma, and where price is likely to pin into expiry
- **Swing traders**: support and resistance from the call wall and put wall
- **Quant and research teams**: a daily GEX and max pain series on a schedule, without paying for a terminal
- **Newsletter and Discord writers**: the levels everyone asks for, every morning

### What you get

Per symbol and expiry:

- `maxPain` and `maxPainDistancePct` (the strike where option holders lose the most at expiry)
- `netGex`, `callGex`, `putGex` in USD per 1% move, and `gexRegime` (positive = dealers dampen moves, negative = they amplify them)
- `gammaFlip`, `gammaFlipDistancePct` and `spotVsFlip`: the price where net GEX changes sign
- `callWall` and `putWall`: strikes with the largest call and put gamma near the price
- `topGexStrikes`: the strikes with the largest net GEX, with call and put open interest
- `putCallOiRatio`, `putCallVolumeRatio`, `callOpenInterest`, `putOpenInterest`
- `underlyingPrice`, `iv30`, `quoteTime`

The `all-expiries` row adds `nearestExpiryMaxPain`, `allExpiriesMaxPain` and the list of expiries used.

### How it is computed

- GEX per contract = gamma x open interest x 100 x price² x 1%. Calls count positive and puts negative (the usual dealer-positioning convention).
- The gamma flip is found by re-pricing Black-Scholes gamma for every contract at prices from -20% to +20% and finding where net GEX crosses zero.
- Max pain is the strike that minimizes total intrinsic value of all open calls and puts at expiry.

### Example input

```json
{
  "symbols": ["SPY", "SPX", "TSLA"],
  "maxDaysToExpiry": 30,
  "maxExpiries": 3
}
```

### Example output

```json
{
  "symbol": "SPY",
  "rowType": "all-expiries",
  "underlyingPrice": 754.37,
  "nearestExpiryMaxPain": 762,
  "allExpiriesMaxPain": 759,
  "putCallOiRatio": 1.151,
  "netGex": -887218119,
  "gexRegime": "negative",
  "gammaFlip": 763.47,
  "callWall": 760,
  "putWall": 758
}
```

### Pricing

Pay per symbol analyzed; all its expiry rows are included. Unknown or non-optionable symbols are free.

### Notes

- Data is Cboe's delayed feed, so levels lag the market by about 15 minutes. Open interest updates once a day, overnight.
- GEX assumes customers buy options and dealers sell them, the standard simplification; real positioning can differ.
- Need the raw chain, greeks or unusual activity? Use [Stock Options Scraper](https://apify.com/scrapemint/stock-options-scraper). For earnings plays, see [Earnings Expected Move](https://apify.com/scrapemint/earnings-expected-move).

# Actor input Schema

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

US stock, ETF or index tickers. Indexes work bare (SPX, NDX, RUT, VIX).

## `maxDaysToExpiry` (type: `integer`):

Only include expiries within this many days. 0 = today's (0DTE) only.

## `maxExpiries` (type: `integer`):

Nearest N expiries included in the calculation.

## `includeExpiryRows` (type: `boolean`):

Add a row per expiry next to the all-expiries row for each symbol.

## `strikeRangePercent` (type: `integer`):

Call/put walls and top GEX strikes are picked within this distance of the current price.

## `topStrikes` (type: `integer`):

How many strikes to list in topGexStrikes.

## Actor input object example

```json
{
  "symbols": [
    "SPY",
    "SPX",
    "QQQ",
    "TSLA",
    "NVDA"
  ],
  "maxDaysToExpiry": 60,
  "maxExpiries": 6,
  "includeExpiryRows": true,
  "strikeRangePercent": 25,
  "topStrikes": 10
}
```

# Actor output Schema

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

Max pain, GEX, gamma flip, call/put walls and put/call ratios per symbol and expiry.

## `summary` (type: `string`):

Symbols analyzed and rows written.

# 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",
        "SPX",
        "QQQ",
        "TSLA",
        "NVDA"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapemint/options-max-pain-gamma-exposure").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",
        "SPX",
        "QQQ",
        "TSLA",
        "NVDA",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("scrapemint/options-max-pain-gamma-exposure").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",
    "SPX",
    "QQQ",
    "TSLA",
    "NVDA"
  ]
}' |
apify call scrapemint/options-max-pain-gamma-exposure --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapemint/options-max-pain-gamma-exposure"
        }
    }
}
```

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/3M4guSUk4ZNfx2ytn/builds/qGCSsfgcNfUipfqdK/openapi.json
