Skip to content

Accounts

ibc.rest.accounts.Accounts

Client for managing accounts via the Interactive Brokers API.

__init__(ib_client, ib_session)

Initializes the Accounts client.

Parameters

ib_client : InteractiveBrokersClient The InteractiveBrokersClient Python Client.

InteractiveBrokersSession

The IB session handler.

accounts()

Returns the Users Accounts.

Overview

Returns a list of accounts the user has trading access to, their respective aliases and the currently selected account. Note this endpoint must be called before modifying an order or querying open orders.

Returns

list[Account]: A list of Account model instances parsed from the response.

Usage

>>> accounts_services = ibc_client.accounts
>>> accounts_services.accounts()

pnl_server_account()

Returns an object containing PnL for the selected account and its models (if any).

Returns

dict: An AccountPnL resource.

Usage

>>> accounts_services = ibc_client.accounts
>>> accounts_services.pnl_server_account()