Skip to main content

Interactive Brokers (IBKR) Report Parser for MyTax (vero.fi)

Project description

ibkr-report-parser

Python versions supported PyPI status CI codecov Code style: black

Interactive Brokers (IBKR) Report Parser for MyTax (vero.fi) - not affiliated with either service

Example

Example

How to run locally

Option 1: pip

pip install ibkr-report-parser
ibkr-report-parser

Option 2: Docker

docker pull ghcr.io/oittaa/ibkr-report-parser
docker run --rm -d -p 8080:8080 --name ibkr-report-parser ghcr.io/oittaa/ibkr-report-parser

Use the app

Browse to http://127.0.0.1:8080/

Environment variables

  • TITLE The title of the website. Default IBKR Report Parser
  • CURRENCY The currency used in the report output. Default EUR
  • USE_DEEMED_ACQUISITION_COST Whether to use the deemed acquisition cost, if it benefits you. Default TRUE
  • STORAGE_TYPE The storage to save the fetched daily Euro exchange rates, if set to anything other than DISABLED. Currently supported types are LOCAL, AWS, and GCP. Default DISABLED
  • STORAGE_DIR The directory used when STORAGE_TYPE is set to LOCAL. Default .ibkr_storage
  • BUCKET_ID The storage bucket used when STORAGE_TYPE is set to AWS or GCP. Default ""

Testing and debugging

  • DEBUG Flask debug. Default FALSE
  • LOGGING_LEVEL Python logging level. Default INFO
  • EXCHANGE_RATES_URL URL for the Euro exchange rates from European Central Bank. Default https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip

How to build yourself

Python

git clone https://github.com/oittaa/ibkr-report-parser.git
cd ibkr-report-parser
pip install .
ibkr-report-parser

Docker

git clone https://github.com/oittaa/ibkr-report-parser.git
cd ibkr-report-parser
docker build -t ibkr-report-parser:latest .
docker run --rm -d -p 8080:8080 --name ibkr-report-parser ibkr-report-parser

Python API

from ibkr_report import Report

FILE_1 = "tests/test-data/data_single_account.csv"
FILE_2 = "tests/test-data/data_multi_account.csv"

with open(FILE_1, "rb") as file:
    report = Report(file=file, report_currency="EUR", use_deemed_acquisition_cost=True)

with open(FILE_2, "rb") as file:
    report.add_trades(file=file)

print(f"Total selling prices: {report.prices}")
print(f"Total capital gains: {report.gains}")
print(f"Total capital losses: {report.losses}")

for item in report.details:
    print(
        f"{item.symbol=}, {item.quantity=}, {item.buy_date=}, "
        f"{item.sell_date=}, {item.price=}, {item.realized=}"
    )
from ibkr_report import ExchangeRates, StorageType

rates = ExchangeRates(storage_type=StorageType.LOCAL, storage_dir="/tmp/my_storage")
print(rates.get_rate("EUR", "USD", "2020-06-20"))
print(rates.get_rate("GBP", "SEK", "2015-12-31"))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibkr-report-parser-2023.5.2.tar.gz (192.9 kB view details)

Uploaded Source

Built Distribution

ibkr_report_parser-2023.5.2-py3-none-any.whl (196.7 kB view details)

Uploaded Python 3

File details

Details for the file ibkr-report-parser-2023.5.2.tar.gz.

File metadata

  • Download URL: ibkr-report-parser-2023.5.2.tar.gz
  • Upload date:
  • Size: 192.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for ibkr-report-parser-2023.5.2.tar.gz
Algorithm Hash digest
SHA256 a45b6a204c693aa72b9bedf5e0bb15506467cea56eda3673ae62d05fd6003d85
MD5 158396baeda20a80f4f9a0b279ca8927
BLAKE2b-256 3916a33dccd2632ca53aafd332c2ec0fd3a93560acfc8bf65924bd246d187fb3

See more details on using hashes here.

File details

Details for the file ibkr_report_parser-2023.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ibkr_report_parser-2023.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aac5a9248ca71601462a872c900ed6e24effe7bc70cc4d96f8f8abff214c7c63
MD5 3006f72926600de0953de69aac4cc104
BLAKE2b-256 6ee88bc21d50ce63b67fff2976fc44abd34b4e209a6d42d9540a4d052c20d81d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page