From d96dfa02f0278a39507020cbcef09dd473861db2 Mon Sep 17 00:00:00 2001 From: oittaa Date: Fri, 19 Nov 2021 18:00:02 +0100 Subject: [PATCH] Update documentation (#65) --- README.md | 4 ++-- ibkr_report/__init__.py | 4 ++++ ibkr_report/report.py | 23 +++++++++++++++-------- ibkr_report/trade.py | 2 ++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 318235b..60df408 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Browse to http://127.0.0.1:8080/ ## Python API ```python -from ibkr_report.report import Report +from ibkr_report import Report FILE_1 = "test-data/data_single_account.csv" FILE_2 = "test-data/data_multi_account.csv" @@ -73,7 +73,7 @@ for item in report.details: ``` ```python -from ibkr_report.exchangerates import ExchangeRates +from ibkr_report import ExchangeRates rates = ExchangeRates() print(rates.get_rate("EUR", "USD", "2020-06-20")) diff --git a/ibkr_report/__init__.py b/ibkr_report/__init__.py index ce1efc3..72cec5b 100644 --- a/ibkr_report/__init__.py +++ b/ibkr_report/__init__.py @@ -16,6 +16,10 @@ from flask import Flask from ibkr_report import cron, website +from ibkr_report.exchangerates import ExchangeRates +from ibkr_report.report import Report + +__all__ = ["create_app", "ExchangeRates", "Report"] def create_app() -> Flask: diff --git a/ibkr_report/report.py b/ibkr_report/report.py index d32e178..0e3c1d8 100644 --- a/ibkr_report/report.py +++ b/ibkr_report/report.py @@ -25,17 +25,24 @@ class Report: """Total selling prices, total capital gains, and total capital losses calculated from the CSV files. + When calculating the amount of profit or loss, you can deduct the deemed + acquisition cost from the selling price of the shares, instead of deducting + the purchase price of the shares as well as the expenses incurred in + making a profit. + Args: - file (Iterable[bytes]): The input file in CSV format - report_currency (str): The currency used in the output - use_deemed_acquisition_cost (bool): Whether to use acquisition cost + file (Iterable[bytes]): The input file in CSV format. + report_currency (str): The currency used in the output. + use_deemed_acquisition_cost (bool): Whether to use the deemed acquisition cost + if it benefits you. Attributes: - prices (Decimal): Total selling prices - gains (Decimal): Total capital gains - losses (Decimal): Total capital losses - details(List): Details from trades such as dates and quantities - options (ReportOptions): Whether to use acquisition cost, report currency + prices (Decimal): Total selling prices. + gains (Decimal): Total capital gains. + losses (Decimal): Total capital losses. + details(List): Details from trades such as dates and quantities. + options (ReportOptions): Report currency, whether to use the deemed + acquisition cost. """ prices: Decimal = Decimal(0) diff --git a/ibkr_report/trade.py b/ibkr_report/trade.py index 5a89fc1..8e7da1b 100644 --- a/ibkr_report/trade.py +++ b/ibkr_report/trade.py @@ -149,6 +149,8 @@ def deemed_profit(sell_price: Decimal, buy_date: str, sell_date: str) -> Decimal acquisition cost is 20% of the selling price of the shares. If you have owned the shares you sell for at least 10 years, the deemed acquisition cost is 40% of the selling price of the shares. + + https://www.vero.fi/en/individuals/property/investments/selling-shares/ """ multiplier = Decimal(0.8) if get_date(buy_date) <= add_years(get_date(sell_date), -10):