Giter VIP home page Giter VIP logo

ibkr-report-parser's Introduction

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"))

ibkr-report-parser's People

Contributors

dependabot[bot] avatar oittaa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.