Skip to content
Back to skills

Ib Create Consolidated Report

ASecurity

Consolidate IBRK trade CSV files from a directory into a summary report. Groups trades by symbol, underlying, date, strike, buy/sell, and open/close. Outputs both markdown and CSV.

  • 426 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 26, 2026
datapythongobash

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add staskh/trading_skills --skill ib-create-consolidated-report --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ib Create Consolidated Report?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ib Create Consolidated Report
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/staskh-ib-create-consolidated-report/badge)](https://www.skillsdirectory.com/skills/staskh-ib-create-consolidated-report)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ib-create-consolidated-report
description: Consolidate IBRK trade CSV files from a directory into a summary report. Groups trades by symbol, underlying, date, strike, buy/sell, and open/close. Outputs both markdown and CSV.
dependencies: ["trading-skills"]
---

# IB Create Consolidated Report

Reads all CSV files from a given directory (excluding subdirectories), consolidates trade data by key fields, and generates both markdown and CSV reports.

## Instructions

```bash
uv run python scripts/consolidate.py <directory> [--port PORT] [--output-dir OUTPUT_DIR]
```

## Arguments

- `directory` - Path to directory containing IBRK trade CSV files
- `--port` - IB port to fetch unrealized P&L (7497=paper, 7496=live). If not specified, auto-probes both ports (tries 7496 first, then 7497). Defaults to the `IB_PORT` env var when set (`--port` still overrides).
- `--output-dir` - Output directory for reports (default: sandbox/)

## Consolidation Logic

Groups trades by:
- **UnderlyingSymbol** - The underlying ticker (e.g., GOOG, CAT)
- **Symbol** - Full option symbol
- **TradeDate** - Date of the trade
- **Strike** - Strike price
- **Put/Call** - Option type (C or P)
- **Buy/Sell** - Trade direction
- **Open/CloseIndicator** - Whether opening or closing

Aggregates:
- **Quantity** - Sum of quantities
- **Proceeds** - Sum of proceeds
- **NetCash** - Sum of net cash
- **IBCommission** - Sum of commissions
- **FifoPnlRealized** - Sum of realized P&L

Adds column:
- **Position** - SHORT (Sell+Open), LONG (Buy+Open), CLOSE_SHORT (Buy+Close), CLOSE_LONG (Sell+Close)

## Output

Generates two files in the output directory:
- `YYYY-MM-DD_HHmm_[ACCOUNT_]consolidated_trades.md` - Markdown report with summary tables
- `YYYY-MM-DD_HHmm_[ACCOUNT_]consolidated_trades.csv` - CSV with all consolidated data

The IB account ID is included when the IB connection reports one.

## Example Usage

```bash
# Consolidate trades from IBRK reports directory
uv run python scripts/consolidate.py "C:\Users\avrah\OneDrive\Business\Trading\IBRK reports\2stastrading2025"

# Specify custom output directory
uv run python scripts/consolidate.py "C:\path\to\reports" --output-dir "C:\output"
```


## Timezone

All timestamps and time-based calculations must use the `America/New_York` timezone. All JSON output must include `generated_at` (NY time string) and `data_delay` fields.

Files in this skill

  • SKILL.md2.2 KB
  • scripts/consolidate.py11.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.