# Ib Create Consolidated Report

> 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.

- **Type:** Skill
- **Install:** `agentstack add skill-staskh-trading-skills-ib-create-consolidated-report`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [staskh](https://agentstack.voostack.com/s/staskh)
- **Installs:** 0
- **Category:** [Data & Analytics](https://agentstack.voostack.com/c/data-and-analytics)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [staskh](https://github.com/staskh)
- **Source:** https://github.com/staskh/trading_skills/tree/main/.claude/skills/ib-create-consolidated-report

## Install

```sh
agentstack add skill-staskh-trading-skills-ib-create-consolidated-report
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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  [--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).
- `--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:
- `consolidated_trades_YYYY-MM-DD_HHMM.md` - Markdown report with summary tables
- `consolidated_trades_YYYY-MM-DD_HHMM.csv` - CSV with all consolidated data

## 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.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [staskh](https://github.com/staskh)
- **Source:** [staskh/trading_skills](https://github.com/staskh/trading_skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-staskh-trading-skills-ib-create-consolidated-report
- Seller: https://agentstack.voostack.com/s/staskh
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
