Skip to content

Commit

Permalink
Update documentation (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
oittaa authored Nov 19, 2021
1 parent adf298d commit d96dfa0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"))
Expand Down
4 changes: 4 additions & 0 deletions ibkr_report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
23 changes: 15 additions & 8 deletions ibkr_report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions ibkr_report/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d96dfa0

Please sign in to comment.