Python package to generate reports from Interactive Brokers.
Install the module from github,
pip install git+https://https://github.com/westonplatter/finx-reports-ib.git@main
Or add it to your requirements.txt
file,
finx_reports_ib @ git+https://https://github.com/westonplatter/finx-reports-ib.git@main
-
Create a Flex Report in the Interactive Broker website (see this link)
- Query Name = AllAccounts-AnnualReport
- Sections to include in the report. In each, select all Options and all Fields/Columns except:
Serial Number
,Delivery Type
,Commodity Type
,Fineness
,Weight
.- Account Information
- Change in NAV
- Complex Positions
- Mark-to-Market Performance Summary in Base
- Month & Year to Date Performance Summary in Base
- Open Positions
- Option Exercises, Assignments, and Expirations
- Realized and Unrealized Performance Summary in Base
- Accounts = select all desired accounts (python code is able to handle single or multiple accounts)
- Models = Optional
- Format = XML
- Period = Last 365 Days
- Date Format = yyy-MM-dd
- Time Format = HH:mm:ss
- Date/Time Separator = ;semicolon
- ProfitLoss = Default
- Include Canceled Trades = No
- Include Base Currency = No
- Include All Audit Fields = No
- Display Account Alias in Place of Account ID = No
- Breakout by Day = No
-
Clone the repo and install it
git clone [email protected]:westonplatter/finx-reports-ib.git cd finx-reports-ib pip install --edit .
-
Create your own
.env
fileCopy the sample env file,
cp .env.example .env
Edit it with your own values,
IB_JSON='{"accounts": [{"name": "account1", "flex_token": "123", "annual": <ibkr_query_id>}]}'
-
Run the download command
# note that `report-name` matches up with annual key in the .env file python cli.py download --report-name=annual --cache # see the python import/methods in cli.py
-
See files in the
data
directory