# ibkr-report-parser
[![Python versions supported](https://img.shields.io/pypi/pyversions/ibkr-report-parser.svg?logo=python)](https://pypi.org/project/ibkr-report-parser/)
[![PyPI status](https://badge.fury.io/py/ibkr-report-parser.svg)](https://pypi.org/project/ibkr-report-parser/)
[![CI](https://github.com/oittaa/ibkr-report-parser/actions/workflows/main.yml/badge.svg)](https://github.com/oittaa/ibkr-report-parser/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/oittaa/ibkr-report-parser/branch/main/graph/badge.svg?token=BV211C3GE5)](https://codecov.io/gh/oittaa/ibkr-report-parser)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Interactive Brokers (IBKR) Report Parser for MyTax (vero.fi) - not affiliated with either service
## Example
![Example](https://user-images.githubusercontent.com/8972248/141529794-55226165-f844-405f-a251-a91b07701efa.png)
## How to run locally
### Option 1: pip
```shell
pip install ibkr-report-parser
ibkr-report-parser
```
### Option 2: Docker
````shell
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][selling shares], 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
```shell
git clone https://github.com/oittaa/ibkr-report-parser.git
cd ibkr-report-parser
pip install .
ibkr-report-parser
```
### Docker
```shell
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
```python
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=}"
)
```
```python
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"))
```
[selling shares]: https://www.vero.fi/en/individuals/property/investments/selling-shares/
Raw data
{
"_id": null,
"home_page": "https://github.com/oittaa/ibkr-report-parser",
"name": "ibkr-report-parser",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "Interactive Brokers,IBKR,OmaVero,MyTax,vero.fi",
"author": "Oittaa",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/39/16/a33dccd2632ca53aafd332c2ec0fd3a93560acfc8bf65924bd246d187fb3/ibkr-report-parser-2023.5.2.tar.gz",
"platform": null,
"description": "# ibkr-report-parser\n\n[![Python versions supported](https://img.shields.io/pypi/pyversions/ibkr-report-parser.svg?logo=python)](https://pypi.org/project/ibkr-report-parser/)\n[![PyPI status](https://badge.fury.io/py/ibkr-report-parser.svg)](https://pypi.org/project/ibkr-report-parser/)\n[![CI](https://github.com/oittaa/ibkr-report-parser/actions/workflows/main.yml/badge.svg)](https://github.com/oittaa/ibkr-report-parser/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/oittaa/ibkr-report-parser/branch/main/graph/badge.svg?token=BV211C3GE5)](https://codecov.io/gh/oittaa/ibkr-report-parser)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nInteractive Brokers (IBKR) Report Parser for MyTax (vero.fi) - not affiliated with either service\n\n## Example\n\n![Example](https://user-images.githubusercontent.com/8972248/141529794-55226165-f844-405f-a251-a91b07701efa.png)\n\n## How to run locally\n\n### Option 1: pip\n```shell\npip install ibkr-report-parser\nibkr-report-parser\n```\n\n### Option 2: Docker\n````shell\ndocker pull ghcr.io/oittaa/ibkr-report-parser\ndocker run --rm -d -p 8080:8080 --name ibkr-report-parser ghcr.io/oittaa/ibkr-report-parser\n````\n\n### Use the app\n\nBrowse to http://127.0.0.1:8080/\n\n## Environment variables\n\n* `TITLE` The title of the website. Default `IBKR Report Parser`\n* `CURRENCY` The currency used in the report output. Default `EUR`\n* `USE_DEEMED_ACQUISITION_COST` Whether to use the [deemed acquisition cost][selling shares], if it benefits you. Default `TRUE`\n* `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`\n* `STORAGE_DIR` The directory used when `STORAGE_TYPE` is set to `LOCAL`. Default `.ibkr_storage`\n* `BUCKET_ID` The storage bucket used when `STORAGE_TYPE` is set to `AWS` or `GCP`. Default `\"\"`\n\n### Testing and debugging\n* `DEBUG` Flask debug. Default `FALSE`\n* `LOGGING_LEVEL` Python logging level. Default `INFO`\n* `EXCHANGE_RATES_URL` URL for the Euro exchange rates from European Central Bank. Default `https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip`\n\n## How to build yourself\n\n### Python\n```shell\ngit clone https://github.com/oittaa/ibkr-report-parser.git\ncd ibkr-report-parser\npip install .\nibkr-report-parser\n```\n\n### Docker\n```shell\ngit clone https://github.com/oittaa/ibkr-report-parser.git\ncd ibkr-report-parser\ndocker build -t ibkr-report-parser:latest .\ndocker run --rm -d -p 8080:8080 --name ibkr-report-parser ibkr-report-parser\n```\n\n## Python API\n\n```python\nfrom ibkr_report import Report\n\nFILE_1 = \"tests/test-data/data_single_account.csv\"\nFILE_2 = \"tests/test-data/data_multi_account.csv\"\n\nwith open(FILE_1, \"rb\") as file:\n report = Report(file=file, report_currency=\"EUR\", use_deemed_acquisition_cost=True)\n\nwith open(FILE_2, \"rb\") as file:\n report.add_trades(file=file)\n\nprint(f\"Total selling prices: {report.prices}\")\nprint(f\"Total capital gains: {report.gains}\")\nprint(f\"Total capital losses: {report.losses}\")\n\nfor item in report.details:\n print(\n f\"{item.symbol=}, {item.quantity=}, {item.buy_date=}, \"\n f\"{item.sell_date=}, {item.price=}, {item.realized=}\"\n )\n\n```\n\n```python\nfrom ibkr_report import ExchangeRates, StorageType\n\nrates = ExchangeRates(storage_type=StorageType.LOCAL, storage_dir=\"/tmp/my_storage\")\nprint(rates.get_rate(\"EUR\", \"USD\", \"2020-06-20\"))\nprint(rates.get_rate(\"GBP\", \"SEK\", \"2015-12-31\"))\n```\n\n[selling shares]: https://www.vero.fi/en/individuals/property/investments/selling-shares/\n",
"bugtrack_url": null,
"license": "",
"summary": "Interactive Brokers (IBKR) Report Parser for MyTax (vero.fi)",
"version": "2023.5.2",
"project_urls": {
"Homepage": "https://github.com/oittaa/ibkr-report-parser"
},
"split_keywords": [
"interactive brokers",
"ibkr",
"omavero",
"mytax",
"vero.fi"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6ee88bc21d50ce63b67fff2976fc44abd34b4e209a6d42d9540a4d052c20d81d",
"md5": "3006f72926600de0953de69aac4cc104",
"sha256": "aac5a9248ca71601462a872c900ed6e24effe7bc70cc4d96f8f8abff214c7c63"
},
"downloads": -1,
"filename": "ibkr_report_parser-2023.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3006f72926600de0953de69aac4cc104",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 196652,
"upload_time": "2023-05-02T09:39:28",
"upload_time_iso_8601": "2023-05-02T09:39:28.358842Z",
"url": "https://files.pythonhosted.org/packages/6e/e8/8bc21d50ce63b67fff2976fc44abd34b4e209a6d42d9540a4d052c20d81d/ibkr_report_parser-2023.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3916a33dccd2632ca53aafd332c2ec0fd3a93560acfc8bf65924bd246d187fb3",
"md5": "158396baeda20a80f4f9a0b279ca8927",
"sha256": "a45b6a204c693aa72b9bedf5e0bb15506467cea56eda3673ae62d05fd6003d85"
},
"downloads": -1,
"filename": "ibkr-report-parser-2023.5.2.tar.gz",
"has_sig": false,
"md5_digest": "158396baeda20a80f4f9a0b279ca8927",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 192904,
"upload_time": "2023-05-02T09:39:30",
"upload_time_iso_8601": "2023-05-02T09:39:30.403770Z",
"url": "https://files.pythonhosted.org/packages/39/16/a33dccd2632ca53aafd332c2ec0fd3a93560acfc8bf65924bd246d187fb3/ibkr-report-parser-2023.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-02 09:39:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "oittaa",
"github_project": "ibkr-report-parser",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "flask",
"specs": [
[
"==",
"2.3.2"
]
]
},
{
"name": "google-cloud-storage",
"specs": [
[
"==",
"2.8.0"
]
]
}
],
"lcname": "ibkr-report-parser"
}