staskh avatar

Ib Option Chain

This pulls option chain data directly from your Interactive Brokers account through TWS or IB Gateway. You get calls and puts with all the expected fields: strikes, bid/ask spreads, volume, open interest, and implied volatility. It's built for when you need actual IBKR data instead of a third-party feed, which matters if you're trading through IB and want to see exactly what your broker sees. The two-step flow is a bit clunky (fetch expiries first, then the chain), but that's how IB's API works. Outputs clean JSON that includes the underlying price for reference. Requires your local IB gateway running, so this isn't pulling data from the cloud.

GitHub stars
248
last updated
Jun 11, 2026

Install

$ npx -y skills add staskh/trading_skills --skill ib-option-chain --agent claude-code

Installs into .claude/skills of the current project.

Files

IB Option Chain

Fetch option chain data from Interactive Brokers for a specific expiration date. Handles equities/ETFs (Stock/OPT) and futures options (FOP). The asset type and exchange are resolved from IB contract details (no hardcoded symbol table): auto-detect tries a SMART stock first and falls back to a future when no stock exists (so NQ, GC, RTY resolve as futures, while AAPL resolves as a stock even though it has an obscure single-stock future). Tickers that are both a stock and a futures root (e.g. ES=Eversource, CL=Colgate) default to the equity — pass --sec-type fut to force the future.

IB Connection

TWS or IB Gateway must be running locally with API enabled:

  • Paper trading — port 7497
  • Live trading — port 7496
  • IB_PORT env var — default port when --port is omitted (e.g. IB_PORT=4001 for a Gateway container). Precedence: --port flag > IB_PORT > built-in default. Set it in the shell or a .env file.

Sponsors

Details

Repository
github.com/staskh/trading_skills
Categories
Backend & APIs, Finance & Trading
License
MIT
First seen
Jun 11, 2026

More from staskh/trading_skills

All 28
1staskh avatarib-portfoliostaskh/trading_skillsGet portfolio positions from Interactive Brokers. Use when user asks about their portfolio, positions, holdings, or what stocks they own. Requires TWS or IB Gat0skills.sh installs
2staskh avatarib-stop-lossstaskh/trading_skillsDownside stop-loss management for PMCC, naked LEAPS, and stock positions in IB. Computes stop prices, detects alerts, and places conditional combo orders. Dry-r0skills.sh installs
3telagod avatardesigning-architecturestelagod/code-abyssArchitecture knowledge reference covering API design, security architecture, cloud-native patterns, caching strategies, message queues, and data security. Use w0skills.sh installs
4teng-lin avatarnotebooklmteng-lin/notebooklm-pyComplete API for Google NotebookLM - full programmatic access including features not in the web UI. Create notebooks, add sources, generate all artifact types, 0skills.sh installs
5ThinkInAIXYZ avataradd-providerThinkInAIXYZ/deepchatAdd a DeepChat LLM provider through explicit reviewed source changes. Use when a developer asks Codex to add a provider, provider profile, upstream provider con0skills.sh installs
6tinyplex avatarbuild-with-tinybasetinyplex/tinybaseScaffold, extend, and verify reactive local-first JavaScript or TypeScript applications with TinyBase. Use when choosing TinyBase for in-memory tabular or key-v0skills.sh installs