Account P&L
get_pnlFetch live account P&L (daily, unrealized, realized) in base currency. Get a fresh one-shot reading without managing subscriptions.
Instructions
Return the account's live P&L: today's (daily), unrealized and realized, in base currency.
One-shot: subscribes to IBKR's P&L feed, waits a few seconds at most for the first
update (usually about a second), and cancels, so every call is a fresh reading and
nothing needs unsubscribing. Errors: request_timeout when IBKR sends nothing (right
after login, or an account without data); retry once before giving up.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | No | IBKR account id, e.g. DU1234567. Omit to use the default account; list_accounts shows which accounts are allowed. | |
| model_code | No | Financial-advisor model code, to scope the result to one model portfolio. Omit for the whole account (normal for non-advisor accounts). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | Yes | When this server read the values (UTC); IBKR refreshes P&L about every second. | |
| account | Yes | ||
| daily_pnl | No | P&L since the start of today's session. | |
| model_code | No | ||
| realized_pnl | No | Closed P&L today. | |
| unrealized_pnl | No | Open-position P&L. |