29 releases (5 stable)
1.3.0 | Sep 22, 2023 |
---|---|
1.2.1 | Jul 1, 2023 |
1.2.0 | Mar 16, 2023 |
0.11.0 | Feb 21, 2023 |
0.3.1 | Dec 29, 2022 |
#119 in Finance
80 downloads per month
67KB
1.5K
SLoC
interactive-brokers-flex-rs
Tools to assist with IB Flex reports and Ledger-cli comparison
This crate contains a CLI application and is also a library which assists working with Flex Reports from Interactive Brokers. It simplifies the Flex Query download and compares the downloaded transactions (distributions and tax) to the records in Ledger, identifying missing ones.
There are several components in the package:
- The command-line application (CLI)
ibflex
, provides all the features of theibflex
library ibflex
library exposes the following functionality:- downloads the IB Flex Query report
- parses IB Flex Query report
- runs Ledger-cli to retrieve the transactions in the last 60 days
- compares the Cash Transactions from the downloaded Flex Query .xml report to the Ledger transactions
as-symbols
crate provides the Symbol mapping between IB Flex report and Ledger. I.e. symbolVHYL
in the report isVHYL_AS
in Ledger.
The project started as a rewrite of my Python scripts and is intended to be expanded as needed, to parse Flex Queries.
Configuration
To view the current configuration, run
ibflex cfg
The config file will be created automatically if it does not exist.
To edit the values, use any text editor.
Symbols Configuration
See as-symbols
crate for instructions on how to set up the symbols data file.
At the moment this is required for the symbol mapping. The symbols in IB (i.e. VHYL) may be mapped to a different symbol in Ledger (i.e. VHYL_AS).
Usage
Downloading the Flex Query report requires Query Id and the Token. These can be passed in several ways:
- as parameters to the download (Dl) method. Use parameters
--queryid
and--token
. - as environment variables:
The application will read the values from environment variables:
IBFLEX_TOKEN
IBFLEX_QUERYID
- in the configuration file: The application will read the configuration file
ibflex.toml
, which is located in the current directory. See the section below.
Download
The required parameters for downloading the Flex report are:
flex_query_id
ib_token
Once this is set up, invoke the CLI:
ifblex dl
This will save the report in the current directory. The filename will contain today's date.
Comparison
To compare the transactions, run
ibflex cmp
This will compare the downloaded IB transactions to the transactions in Ledger. The new Dividend and Tax transactions will be reported as New. The other transactions will be reported as Skipped.
Changelog
See Changelog
Credits
- ibflex Python library
License
See LICENSE file.
Dependencies
~13–27MB
~390K SLoC