
Python for Algorithmic Trading Cookbook
By :

The IB API offers a comprehensive snapshot of portfolio data, returning 157 different portfolio values through a single API call. This data provides a detailed view of our portfolios, encompassing a wide range of metrics and data points. Account values delivered via updateAccountValue
can be classified in the following way:
-C
-S
In this recipe, we’ll build the code to get those data points.
We assume you’ve created the client.py
, wrapper.py
, and app.py
files in the trading-app
directory. If not, do it now.
The first step is to incorporate the account number into our IBApp
class. While an account number is optional for requesting account-level data in a single account structure, it’s best practice to specify it in the case of multiple accounts. Then, we’ll add the callback to the IBWrapper...