Get the FREE Ultimate OpenClaw Setup Guide →

ib-report-delta-adjusted-notional-exposure

npx machina-cli add skill staskh/trading_skills/ib-report-delta-adjusted-notional-exposure --openclaw
Files (1)
SKILL.md
2.2 KB

IB Delta-Adjusted Notional Exposure Report

Calculate and report delta-adjusted notional exposure across all Interactive Brokers accounts.

Prerequisites

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

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

Instructions

Step 1: Gather Data

uv run python scripts/delta_exposure.py [--port PORT]

The script returns JSON to stdout with all position deltas and summary data.

Step 2: Format Report

Read templates/markdown-template.md for formatting instructions. Generate a markdown report from the JSON data and save to sandbox/.

Filename: delta_exposure_report_{YYYYMMDD}_{HHMMSS}.md

Step 3: Report Results

Present the summary table (total long, short, net) and top exposures to the user. Include the saved report path.

Arguments

  • --port - IB port (default: 7496 for live trading, use 7497 for paper)

JSON Output

Returns delta-adjusted notional exposure with:

  • connected - Boolean
  • accounts - List of account IDs
  • position_count - Total positions
  • positions - Array of positions with symbol, delta, delta_notional, spot price
  • summary - Totals for long, short, and net delta notional
    • by_account - Long/short breakdown by account
    • by_underlying - Long/short/net breakdown by symbol

Methodology

  • Equity Options: Delta calculated via Black-Scholes with estimated IV based on moneyness
  • Futures: Delta = 1.0 (full notional exposure)
  • Futures Options: Delta calculated with lower IV assumption (20%)
  • Stocks: Delta = 1.0

Delta-adjusted notional = delta x spot price x quantity x multiplier

Examples

# Live trading (default port 7496)
uv run python scripts/delta_exposure.py

# Paper trading (port 7497)
uv run python scripts/delta_exposure.py --port 7497

Source

git clone https://github.com/staskh/trading_skills/blob/main/.claude/skills/ib-report-delta-adjusted-notional-exposure/SKILL.mdView on GitHub

Overview

Calculates delta-adjusted notional exposure across all Interactive Brokers accounts. The tool uses Black-Scholes to derive option deltas and reports long versus short exposure by account and by underlying. It's ideal for assessing delta risk, portfolio exposure, and directional bets in multi-account portfolios.

How This Skill Works

It connects to TWS/IB Gateway via the IB API, querying current positions for all accounts (port 7496 for live, 7497 for paper). It computes delta-adjusted notional for each position (delta × spot × quantity × multiplier), using Black-Scholes for equity options, 1.0 for stocks and futures, and 20% IV for futures options, then aggregates results into per-account and per-underlying summaries. It outputs a JSON payload to stdout and renders a Markdown report from templates to sandbox/delta_exposure_report_<YYYYMMDD>_<HHMMSS>.md.

When to Use It

  • Assess delta risk of a multi-account IBKR portfolio
  • Identify net long vs short exposure by underlying
  • Evaluate directional exposure before trades or hedges
  • Audit portfolio risk for compliance and management reporting
  • Share risk posture with stakeholders via the generated report

Quick Start

  1. Step 1: uv run python scripts/delta_exposure.py [--port PORT]
  2. Step 2: Read templates/markdown-template.md and generate a markdown report saved to sandbox/, filename delta_exposure_report_{YYYYMMDD}_{HHMMSS}.md
  3. Step 3: Review the summary tables (long/short/net by account and underlying) and note the report path

Best Practices

  • Ensure TWS/IB Gateway API is enabled and reachable
  • Use the correct port: 7496 for live, 7497 for paper
  • Verify delta calculations align with instrument types (options, futures, stocks) and note the 20% IV assumption for futures options
  • Run the script when positions change or before hedging decisions
  • Save and review the timestamped Markdown report in sandbox/ before sharing

Example Use Cases

  • Run delta_exposure.py to generate a cross-account delta exposure snapshot
  • Identify top net-long and net-short exposures by underlying to guide hedging
  • Compare per-account delta_notional to rebalance capital or adjust risk budgets
  • Export the markdown report and share the sandbox/ path with risk stakeholders
  • Use the output to evaluate delta risk when introducing new option strategies

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers