Skip to content

Portfolio Analysis

ibc.rest.portfolio_analysis.PortfolioAnalysis

Client for managing portfolio analysis via the Interactive Brokers API.

__init__(ib_client, ib_session)

Initializes the PortfolioAnalysis client.

Parameters

ib_client : InteractiveBrokersClient The InteractiveBrokersClient Python Client.

InteractiveBrokersSession

The IB session handler.

account_performance(account_ids, frequency)

Returns the performance (MTM) for the given accounts, if more than one account is passed, the result is consolidated.

Parameters

account_ids : List[str] A list of account Numbers.

Union[str, Enum]

Frequency of cumulative performance data points: 'D'aily, 'M'onthly,'Q'uarterly. Can be one of 3 possible values: "D" "M" "Q".

Returns

dict: A performance resource.

account_summary(account_ids)

Returns a summary of all account balances for the given accounts, if more than one account is passed, the result is consolidated.

Parameters

account_ids : List[str] A list of account Numbers.

Returns

dict: A performance resource.

transactions_history(account_ids=None, contract_ids=None, currency='USD', days=90)

Transaction history for a given number of conids and accounts. Types of transactions include dividend payments, buy and sell transactions, transfers.

Parameters

account_ids : List[str] A list of account Numbers.

List[str]

A list contract IDs.

str (optional, Default='USD')

The currency for which to return values.

int (optional, Default=90)

The number of days to return.

Returns

dict : A collection of Transactions resource.