agentsclimarketplace

Ib daily pnl

Skill luyangkk/ib-suite/skills/ib-suite/ib-daily-pnl

Read-only Interactive Brokers (IBKR) diagnostics as portable AI-agent skills: account health, positions, daily P&L, trade history, dividends, options Greeks, and a P0–P3 graded portfolio report. Never places orders.

Install
npx -y skills add luyangkk/ib-suite --skill ib-daily-pnl

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 17 days oldThe repository was created 17 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Read-only daily (today's) P&L breakdown from Interactive Brokers. Use when the user asks how their account did today, today's total/realized/unrealized P&L, which positions contributed the most profit or loss today, how each asset class (stock/option/ETF/forex) or currency contributed, or whether one name dominated today's move. Reads live P&L state only — never places, modifies, or cancels an order.

SKILL.md

5.2 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it

ib-daily-pnl

Read-only daily P&L breakdown for the IB analyst toolchain. Answers "how did my account do today, and who moved it?" in one call: today's total P&L split into realized and unrealized, every position's contribution ranked into winners and losers, aggregated by asset class and by currency, with the single position that moved today's number the most flagged. This skill connects with readonly=True and only reads; it NEVER places, modifies, or cancels an order.

Why this is a live pull (not the data lake)

Daily P&L is an IB session concept — it resets every trading day and exists only on a live connection. It is NOT in the /ib-sync snapshot, so this skill connects directly and reads IB's pnl subscription (reqPnL for account totals, reqPnLSingle per position). Nothing is persisted. IB reports every P&L figure already in the account base currency, so contributions sum directly with no FX step here.

Prerequisites

Config and the shared venv are owned by the ib-suite index skill (see its first-run setup). Start IB Gateway (paper on 4002 / live on 4001) with API access, and tick Read-Only API in Gateway settings as an extra guard.

Commands

/ib-daily-pnl — read-only daily P&L breakdown

{baseDir}/../.venv/bin/python {baseDir}/scripts/daily_pnl.py --config .ib-suite/config.yaml

Prints one JSON object to stdout (parseable). It reads live P&L state and does not write to the data lake — nothing is persisted.

What the output carries

Account totals (base currency, from reqPnL):

Report fieldJSON keySource
Today's total P&Ldaily_pnlreqPnL().dailyPnL
Realized P&L (today)realized_pnlreqPnL().realizedPnL
Unrealized P&Lunrealized_pnlreqPnL().unrealizedPnL

Per position (positions[], base currency, from reqPnLSingle):

Report fieldJSON keySource
Symbolsymbolcontract.symbol
Instrument namenamereqContractDetails().longName
Asset typesec_typecontract.secType (STK/OPT/CASH/…)
Asset classasset_classderived: STK+stockType → Stock/ETF; OPT → Option; CASH → Forex
Today's P&Ldaily_pnlreqPnLSingle().dailyPnL
Realized P&L (today)realized_pnlreqPnLSingle().realizedPnL
Unrealized P&Lunrealized_pnlreqPnLSingle().unrealizedPnL
Trading currencycurrencycontract.currency

Rankings and attribution (computed in the script, deterministic)

Present these verbatim without re-deriving any order:

ViewJSON keyOrder / content
Profit contributionrankings.by_profit_contribdaily_pnl, high → low (winners)
Loss contributionrankings.by_loss_contribdaily_pnl, most negative first (losers)
By asset classattribution.by_asset_class{class: summed daily_pnl}
By currencyattribution.by_currency{currency: summed daily_pnl}
Top drivertop_driversingle position with the largest `

List at least the top 10 by profit and the top 10 by loss (or all positions if fewer). State the top_driver name, its P&L, and its share_of_gross as the single-name concentration conclusion.

What this skill will NOT fabricate (price vs vol vs theta vs FX)

A single read-only pull gives each name's net daily P&L, not its decomposition into price change vs. implied-volatility change vs. time-value decay (theta) vs. FX change. That split needs day-over-day Greeks and exchange-rate history this snapshot does not contain. The output ships that boundary verbatim in attribution.note. Report it as a data limitation and use the asset-class buckets as the honest proxy:

  • Stock / ETF P&L ≈ price change.
  • Forex (CASH) P&L ≈ FX change.
  • Option P&L blends price / volatility / theta — do not claim a precise split without cross-day Greeks.

For a true decomposition, capture daily Greek/FX snapshots over time (a separate, larger change) — do not invent numbers from one pull.

Notes

  • Every P&L figure is base currency (IB converts before publishing the pnl subscription), so contributions sum directly; currency is kept only for the per-currency breakdown, not for conversion.
  • All pnl/pnlSingle subscriptions are always cancelled after reading — this is a read-only pull that leaves no live subscriptions behind.
  • Same clientId allows only one active Gateway connection — the shared config.yaml id is reused; close other sessions if the connect stalls.
  • Read-only guarantee: the entry script imports no order API and connects with readonly=True. Do not add a write path here.

What ships with it: 3 files

19.5 KB alongside SKILL.md, 2 of them executable

scripts/

Keep looking

Skills are one crate of 326,984. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.