# Delta Exposure Report - Markdown Template

Format the JSON data into a markdown report saved to `sandbox/`.

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

## JSON Structure

```
{
  "connected": true,
  "accounts": ["ACC1", "ACC2"],
  "position_count": 25,
  "positions": [
    {
      "account": "ACC1",
      "symbol": "AAPL",
      "sec_type": "OPT",       // OPT, FOP, FUT, STK
      "strike": 180.0,         // options only
      "expiry": "20260321",    // options only, YYYYMMDD
      "right": "C",            // C or P, options only
      "qty": -5,
      "spot": 185.50,
      "delta": -0.35,
      "multiplier": 100,
      "raw_notional": -92750.0,
      "delta_notional": -32462.5
    }
  ],
  "summary": {
    "total_long_delta_notional": 500000.0,
    "total_short_delta_notional": -250000.0,
    "net_delta_notional": 250000.0,
    "by_account": {
      "ACC1": { "long": 300000.0, "short": -150000.0 }
    },
    "by_underlying": {
      "AAPL": { "long": 100000.0, "short": -50000.0, "net": 50000.0 }
    }
  }
}
```

## Report Sections

### 1. Header
```markdown
# Delta-Adjusted Notional Exposure Report
**Generated:** YYYY-MM-DD HH:MM:SS
**Accounts:** ACC1, ACC2
**Total Positions:** N
```

### 2. Portfolio Summary

| Metric | Value |
|--------|-------|
| Total Long Delta Notional | $X,XXX,XXX |
| Total Short Delta Notional | ($X,XXX,XXX) |
| **Net Delta Notional** | **$X,XXX,XXX** |

### 3. Summary by Account

| Account | Long | Short | Net |
|---------|------|-------|-----|

Calculate net as `long + short` for each account.

### 4. Summary by Underlying

| Symbol | Long | Short | Net |
|--------|------|-------|-----|

Sort by absolute net (descending).

### 5. Top Long Delta Exposures

Top 10 positions sorted by delta_notional (descending, positive only):

| Account | Symbol | Type | Strike | Expiry | Qty | Delta | Spot | Delta Notional |
|---------|--------|------|--------|--------|-----|-------|------|----------------|

### 6. Top Short Delta Exposures

Top 10 positions sorted by delta_notional (ascending, negative only):

| Account | Symbol | Type | Strike | Expiry | Qty | Delta | Spot | Delta Notional |
|---------|--------|------|--------|--------|-----|-------|------|----------------|

### 7. Detailed Positions by Account (full report only)

Group by account, then split into long/short subsections with full position tables.

### 8. Detailed Positions by Symbol (full report only)

Group by symbol with all positions listed.

## Formatting Rules

- Currency: `$X,XXX.XX` format, negative values in parentheses: `($X,XXX.XX)`
- Delta: 2 decimal places
- Spot: 2 decimal places
- Expiry: format YYYYMMDD as "Mon DD, YYYY"
- Type: "OPT" -> show strike + right (e.g., "$180 C"), "STK" -> "Stock", "FUT" -> "Future"
- Sort tables by absolute delta notional descending unless otherwise specified

## Footer
```markdown
*Report generated by Trading Skills on YYYY-MM-DD HH:MM*
```
