Recipe, one Python file
Term structure watch
Front versus back implied vol for a few names, flagging the ones in backwardation. Fetches the implied vol term structure for each symbol and compares the nearest expiration's at-the-money vol with the furthest one returned. A front month above the back is backwardation, usually an event or stress; the script prints the slope in vol points and per-expiry straddle prices for the first few expirations.
What it prints
The output,
as captured.
Run against the live API on 2026-09-08 with a real token. Calendar and diagonal traders, and anyone watching for event premium in the front month.
SPY spot 767.24: backwardation (front richer), slope -3.9 vol pts from 2026-09-08 to 2026-09-15
2026-09-08 0d ATM IV 15.4% straddle 2.55 move 0.33%
2026-09-09 1d ATM IV 12.0% straddle 4.32 move 0.56%
2026-09-10 2d ATM IV 12.1% straddle 5.86 move 0.76%
2026-09-11 3d ATM IV 13.5% straddle 7.88 move 1.03%
NVDA spot 230.61: backwardation (front richer), slope -6.3 vol pts from 2026-09-09 to 2026-09-21
2026-09-09 1d ATM IV 43.4% straddle 4.62 move 2.01%
2026-09-11 3d ATM IV 41.2% straddle 7.16 move 3.10%
2026-09-14 6d ATM IV 34.7% straddle 8.18 move 3.55%
2026-09-16 8d ATM IV 36.3% straddle 9.94 move 4.31%
TSLA spot 358.54: backwardation (front richer), slope -13.1 vol pts from 2026-09-09 to 2026-09-21
2026-09-09 1d ATM IV 54.2% straddle 9.12 move 2.54%
2026-09-11 3d ATM IV 49.5% straddle 13.40 move 3.74%
2026-09-14 6d ATM IV 41.6% straddle 15.57 move 4.34%
2026-09-16 8d ATM IV 44.0% straddle 18.81 move 5.25%
The script
One file,
requests and nothing else.
Set APEXVOL_API_TOKEN from Account, then API Access, and run it. The token is the only configuration.
import os
import sys
import requests
# One token, any paid or trial plan: Account, then API Access.
TOKEN = os.environ.get("APEXVOL_API_TOKEN") or sys.exit("set APEXVOL_API_TOKEN")
BASE = os.environ.get("APEXVOL_API_URL", "https://apexvol.com") + "/api/mcp/data"
S = requests.Session()
S.headers["Authorization"] = f"Bearer {TOKEN}"
def get(path, **params):
r = S.get(BASE + path, params=params, timeout=90)
body = r.json()
if not body.get("success"):
sys.exit(f"{path}: HTTP {r.status_code}: {body.get('error')}")
return body["data"]
SYMBOLS = ["SPY", "NVDA", "TSLA"]
for sym in SYMBOLS:
d = get(f"/term-structure/{sym}", num_expirations=6)
ts = [r for r in d["term_structure"] if r.get("atm_iv")]
if len(ts) < 2:
print(f"{sym}: fewer than two priced expirations")
continue
slope = ts[-1]["atm_iv"] - ts[0]["atm_iv"]
shape = "backwardation (front richer)" if slope < 0 else "contango (back richer)"
print(f"{sym} spot {d['stock_price']:,.2f}: {shape}, slope {slope:+.1f} vol pts "
f"from {ts[0]['expiration']} to {ts[-1]['expiration']}")
for r in ts[:4]:
print(f" {r['expiration']} {r['dte']:>3}d ATM IV {r['atm_iv']:>5.1f}% straddle {r['straddle_price']:>7.2f} "
f"move {r['expected_move_pct']:.2f}%")
print()
How it works
- 1. One call per symbol
- GET /term-structure/{ticker}?num_expirations=6 returns ATM IV, straddle price and the expected move per expiration.
- 2. Measure the slope
- Back-month ATM IV minus front-month ATM IV, in vol points.
- 3. Flag backwardation
- A negative slope means the front is richer than the back.
Schedule it
- cron
0 14 * * 1-5 APEXVOL_API_TOKEN=avmcp_... python3 term_structure_watch.py
10:00 New York, weekdays. Times in the crontab are UTC.- Claude Code
/loop 4h python3 term_structure_watch.py
Runs it on an interval inside a session, and the assistant reads the output each time.
The same job, no code
Ask an assistant
with the MCP server.
Connect the ApexVol MCP server and this recipe is one prompt. It ships in the client's prompt picker as recipe-term-structure-watch.
Show me the implied vol term structure for SPY, NVDA and TSLA and tell me which one is in backwardation.
The assistant calls get_term_structure and answers from the same JSON the script prints.Set it up in:
Under the hood
1 endpoint,
one token.
Each card opens the endpoint's page: parameters and bounds, every field, a real response and a console that runs it on your ticker.
Access
- Plan
- Premium and above. Every endpoint follows the tier of its web feature; the chips on the cards say which.
- Cost
- Measured in upstream data requests against the monthly allowance, not calls; a batch call counts one rate-limit unit and one data request per symbol.
GET /api/mcp/data/me/usageshows the meter. - Reference
- The rate-limits guide, the conventions and the error model. The whole API as one Markdown file: /llms-full.txt.
Included with
every paid plan.
From $55 a month. Create a token under Account, then API Access, and this script runs as it is.
Real market data, not a sandbox. See it live on AAPL.