Get the FREE Ultimate OpenClaw Setup Guide →

ib-option-chain

npx machina-cli add skill staskh/trading_skills/ib-option-chain --openclaw
Files (1)
SKILL.md
1.4 KB

IB Option Chain

Fetch option chain data from Interactive Brokers for a specific expiration date.

Prerequisites

User must have TWS or IB Gateway running locally with API enabled:

  • Paper trading: port 7497
  • Live trading: port 7496

Instructions

First, get available expiration dates:

uv run python scripts/options.py SYMBOL --expiries

Then fetch the chain for a specific expiry:

uv run python scripts/options.py SYMBOL --expiry YYYYMMDD

Arguments

  • SYMBOL - Ticker symbol (e.g., AAPL, SPY, TSLA)
  • --expiries - List available expiration dates only
  • --expiry YYYYMMDD - Fetch chain for specific date (IB format: YYYYMMDD, no dashes)
  • --port - IB port (default: 7496 for live trading)

Output

Returns JSON with:

  • calls - Array of call options with strike, bid, ask, lastPrice, volume, openInterest, impliedVolatility
  • puts - Array of put options with same fields
  • underlying_price - Current stock price for reference
  • source - "ibkr"

Present data as a table. Highlight high volume strikes and notable IV levels.

Dependencies

  • ib-async

Source

git clone https://github.com/staskh/trading_skills/blob/main/.claude/skills/ib-option-chain/SKILL.mdView on GitHub

Overview

Fetch real-time option chain data from Interactive Brokers for a chosen expiration date, including calls and puts with strikes, bid/ask, volume, and implied volatility. This is useful when answering questions about options using IBKR data or pulling live quotes from your broker—requires TWS or IB Gateway running locally.

How This Skill Works

Use the local IBKR API (TWS or IB Gateway) to pull expiries and the option chain. First, run: uv run python scripts/options.py SYMBOL --expiries to list available expiries, then run uv run python scripts/options.py SYMBOL --expiry YYYYMMDD to fetch the chain for a specific date. The command outputs JSON with calls, puts, underlying_price, and source set to ibkr; data is presented as a table with high-volume strikes and notable IV highlighted.

When to Use It

  • When you need real-time option quotes for a specific symbol from IBKR.
  • When you want to fetch the option chain for a specific IBKR expiry date.
  • When comparing calls vs puts using volume, price, and implied volatility.
  • When setting up a local development environment with TWS or IB Gateway (API enabled) and APIs ports.
  • When you want a tabular view that highlights high-volume strikes and IV spikes.

Quick Start

  1. Step 1: Ensure TWS or IB Gateway is running with API access enabled (note ports 7496 or 7497).
  2. Step 2: List expiries for SYMBOL: uv run python scripts/options.py SYMBOL --expiries.
  3. Step 3: Fetch the option chain for a chosen date: uv run python scripts/options.py SYMBOL --expiry YYYYMMDD.

Best Practices

  • Ensure IBKR API is enabled in TWS/IB Gateway and use the correct port (7496 for live, 7497 for paper).
  • Use the expiry format YYYYMMDD with no dashes when requesting a chain.
  • Validate the underlying_price against your broker feed before trading decisions.
  • Interpret impliedVolatility in context (IV% vs stock move) and beware IV crush risks.
  • Review the table visualization to spot high-volume strikes and notable IV levels.

Example Use Cases

  • Pull the AAPL chain for 20240119 and inspect high-volume strikes near the ATM.
  • Compare SPY calls and puts for 20250117 to assess IV dispersion.
  • Analyze TSLA IV vs volume across near-term expiries for spread ideas.
  • Verify the reported underlying_price matches your local feed before placing orders.
  • Use the table view to quickly spot unusual volume or IV spikes across symbols.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers