tariochbctools 0.37__py2.py3-none-any.whl → 0.38.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tariochbctools/importers/nordigen/importer.py +7 -3
- tariochbctools/importers/revolut/importer.py +43 -20
- {tariochbctools-0.37.dist-info → tariochbctools-0.38.1.dist-info}/METADATA +9 -9
- {tariochbctools-0.37.dist-info → tariochbctools-0.38.1.dist-info}/RECORD +8 -8
- {tariochbctools-0.37.dist-info → tariochbctools-0.38.1.dist-info}/WHEEL +1 -1
- {tariochbctools-0.37.dist-info → tariochbctools-0.38.1.dist-info}/LICENSE.txt +0 -0
- {tariochbctools-0.37.dist-info → tariochbctools-0.38.1.dist-info}/entry_points.txt +0 -0
- {tariochbctools-0.37.dist-info → tariochbctools-0.38.1.dist-info}/top_level.txt +0 -0
@@ -57,9 +57,13 @@ class Importer(importer.ImporterProtocol):
|
|
57
57
|
r.json()["transactions"]["booked"], key=lambda trx: trx["bookingDate"]
|
58
58
|
)
|
59
59
|
for trx in transactions:
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
if "transactionId" in trx:
|
61
|
+
metakv = {
|
62
|
+
"nordref": trx["transactionId"],
|
63
|
+
}
|
64
|
+
else:
|
65
|
+
metakv = {}
|
66
|
+
|
63
67
|
if "creditorName" in trx:
|
64
68
|
metakv["creditorName"] = trx["creditorName"]
|
65
69
|
if "debtorName" in trx:
|
@@ -4,7 +4,7 @@ from datetime import timedelta
|
|
4
4
|
from io import StringIO
|
5
5
|
|
6
6
|
from beancount.core import amount, data
|
7
|
-
from beancount.core.number import D
|
7
|
+
from beancount.core.number import ZERO, D
|
8
8
|
from beancount.ingest import importer
|
9
9
|
from beancount.ingest.importers.mixins import identifier
|
10
10
|
from dateutil.parser import parse
|
@@ -13,10 +13,11 @@ from dateutil.parser import parse
|
|
13
13
|
class Importer(identifier.IdentifyMixin, importer.ImporterProtocol):
|
14
14
|
"""An importer for Revolut CSV files."""
|
15
15
|
|
16
|
-
def __init__(self, regexps, account, currency):
|
16
|
+
def __init__(self, regexps, account, currency, fee=None):
|
17
17
|
identifier.IdentifyMixin.__init__(self, matchers=[("filename", regexps)])
|
18
18
|
self.account = account
|
19
19
|
self.currency = currency
|
20
|
+
self._fee = fee
|
20
21
|
|
21
22
|
def name(self):
|
22
23
|
return super().name() + self.account
|
@@ -46,6 +47,7 @@ class Importer(identifier.IdentifyMixin, importer.ImporterProtocol):
|
|
46
47
|
skipinitialspace=True,
|
47
48
|
)
|
48
49
|
next(reader)
|
50
|
+
is_fee_mode = self._fee is not None
|
49
51
|
for row in reader:
|
50
52
|
try:
|
51
53
|
bal = D(row["Balance"].replace("'", "").strip())
|
@@ -53,37 +55,58 @@ class Importer(identifier.IdentifyMixin, importer.ImporterProtocol):
|
|
53
55
|
amt = amount.Amount(amount_raw, row["Currency"])
|
54
56
|
balance = amount.Amount(bal, self.currency)
|
55
57
|
book_date = parse(row["Completed Date"].strip()).date()
|
58
|
+
fee_amt_raw = D(row["Fee"].replace("'", "").strip())
|
59
|
+
fee = amount.Amount(-fee_amt_raw, row["Currency"])
|
56
60
|
except Exception as e:
|
57
61
|
logging.warning(e)
|
58
62
|
continue
|
59
63
|
|
64
|
+
if is_fee_mode and fee_amt_raw == ZERO:
|
65
|
+
continue
|
66
|
+
|
67
|
+
postings = [
|
68
|
+
data.Posting(self.account, amt, None, None, None, None),
|
69
|
+
]
|
70
|
+
description = row["Description"].strip()
|
71
|
+
if is_fee_mode:
|
72
|
+
postings = [
|
73
|
+
data.Posting(self.account, fee, None, None, None, None),
|
74
|
+
data.Posting(
|
75
|
+
self._fee["account"], -fee, None, None, None, None
|
76
|
+
),
|
77
|
+
]
|
78
|
+
description = f"Fees for {description}"
|
79
|
+
|
80
|
+
assert isinstance(
|
81
|
+
description, str
|
82
|
+
), "Actual type of description is " + str(type(description))
|
83
|
+
|
60
84
|
entry = data.Transaction(
|
61
85
|
data.new_metadata(file.name, 0, {}),
|
62
86
|
book_date,
|
63
87
|
"*",
|
64
88
|
"",
|
65
|
-
|
89
|
+
description,
|
66
90
|
data.EMPTY_SET,
|
67
91
|
data.EMPTY_SET,
|
68
|
-
|
69
|
-
data.Posting(self.account, amt, None, None, None, None),
|
70
|
-
],
|
92
|
+
postings,
|
71
93
|
)
|
72
94
|
entries.append(entry)
|
73
95
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
data.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
96
|
+
if not is_fee_mode:
|
97
|
+
# only add balance after the last (newest) transaction
|
98
|
+
try:
|
99
|
+
book_date = book_date + timedelta(days=1)
|
100
|
+
entry = data.Balance(
|
101
|
+
data.new_metadata(file.name, 0, {}),
|
102
|
+
book_date,
|
103
|
+
self.account,
|
104
|
+
balance,
|
105
|
+
None,
|
106
|
+
None,
|
107
|
+
)
|
108
|
+
entries.append(entry)
|
109
|
+
except NameError:
|
110
|
+
pass
|
88
111
|
|
89
112
|
return entries
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tariochbctools
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.38.1
|
4
4
|
Summary: Importers, plugins and price fetchers for Beancount
|
5
5
|
Home-page: https://github.com/tarioch/beancounttools/
|
6
6
|
Author: Patrick Ruckstuhl
|
@@ -19,7 +19,7 @@ Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
19
19
|
Classifier: License :: OSI Approved :: MIT License
|
20
20
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
21
21
|
License-File: LICENSE.txt
|
22
|
-
Requires-Dist: beancount
|
22
|
+
Requires-Dist: beancount<3,>=2
|
23
23
|
Requires-Dist: bitstampclient
|
24
24
|
Requires-Dist: mt-940
|
25
25
|
Requires-Dist: pyyaml
|
@@ -30,14 +30,14 @@ Requires-Dist: opencv-python
|
|
30
30
|
Requires-Dist: blockcypher
|
31
31
|
Requires-Dist: imap-tools
|
32
32
|
Requires-Dist: undictify
|
33
|
-
Requires-Dist: importlib-metadata
|
33
|
+
Requires-Dist: importlib-metadata; python_version < "3.8"
|
34
34
|
Provides-Extra: testing
|
35
|
-
Requires-Dist: pytest
|
36
|
-
Requires-Dist: pytest-cov
|
37
|
-
Requires-Dist: pytest-mock
|
38
|
-
Requires-Dist: flake8
|
39
|
-
Requires-Dist: black
|
40
|
-
Requires-Dist: isort
|
35
|
+
Requires-Dist: pytest; extra == "testing"
|
36
|
+
Requires-Dist: pytest-cov; extra == "testing"
|
37
|
+
Requires-Dist: pytest-mock; extra == "testing"
|
38
|
+
Requires-Dist: flake8; extra == "testing"
|
39
|
+
Requires-Dist: black; extra == "testing"
|
40
|
+
Requires-Dist: isort; extra == "testing"
|
41
41
|
|
42
42
|
.. image:: https://img.shields.io/pypi/l/tariochbctools.svg
|
43
43
|
:target: https://pypi.python.org/pypi/tariochbctools
|
@@ -19,7 +19,7 @@ tariochbctools/importers/neon/importer.py,sha256=SNG6podG1PI3gABy6eYfv1-mRnPwRjK
|
|
19
19
|
tariochbctools/importers/netbenefits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
tariochbctools/importers/netbenefits/importer.py,sha256=V1C9t9LU09osxBDOz-V8DL4LxhtnuhLRj6WV_idxrTM,5816
|
21
21
|
tariochbctools/importers/nordigen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
-
tariochbctools/importers/nordigen/importer.py,sha256=
|
22
|
+
tariochbctools/importers/nordigen/importer.py,sha256=zj2JcDhaP_WXA1H_ZRyqFiN3EqsvY_ZZWLdJiBoijW8,3743
|
23
23
|
tariochbctools/importers/nordigen/nordigen_config.py,sha256=jT4vgEKc35qgXqF8_bRbXLHUrkgsSDKHfhDbEw5OXD4,4903
|
24
24
|
tariochbctools/importers/postfinance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
tariochbctools/importers/postfinance/importer.py,sha256=1oY_9PzUlkJw_gABqHXZ2CaB06xegzNGkc_U3Eoci1M,2452
|
@@ -27,7 +27,7 @@ tariochbctools/importers/quickfile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
27
27
|
tariochbctools/importers/quickfile/importer.py,sha256=0HRVl-OXkCq8T5Uz04gGCGlkRXZ3Mp1y8AldW8ezBHg,6544
|
28
28
|
tariochbctools/importers/raiffeisench/importer.py,sha256=L6X0vlAuL8__DmZbs_T-r-A8SH9VH05KLkL7SubFouA,995
|
29
29
|
tariochbctools/importers/revolut/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
|
-
tariochbctools/importers/revolut/importer.py,sha256=
|
30
|
+
tariochbctools/importers/revolut/importer.py,sha256=TtGzHl5v_i7IYBNFkdNosIvpBRO6_p5i_7qU2Cml2L0,3885
|
31
31
|
tariochbctools/importers/schedule/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
tariochbctools/importers/schedule/importer.py,sha256=g1q7NwGzwkj25LknOguf3b7iJ0v4JXET01a8N3cWu2U,1526
|
33
33
|
tariochbctools/importers/swisscard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -47,9 +47,9 @@ tariochbctools/plugins/check_portfolio_sum.py,sha256=naJ2j6BFpQhJhT2c-gfjyIdcYe0
|
|
47
47
|
tariochbctools/plugins/generate_base_ccy_prices.py,sha256=Phw314qox3jpNgC5-GcnmyYcLkMkrd8xsWS-wYwdj6o,1236
|
48
48
|
tariochbctools/plugins/prices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
tariochbctools/plugins/prices/ibkr.py,sha256=9OwaZvI55bCj7H80K2iLZVsGLpuCyaoCnyuTS9e1_-c,1294
|
50
|
-
tariochbctools-0.
|
51
|
-
tariochbctools-0.
|
52
|
-
tariochbctools-0.
|
53
|
-
tariochbctools-0.
|
54
|
-
tariochbctools-0.
|
55
|
-
tariochbctools-0.
|
50
|
+
tariochbctools-0.38.1.dist-info/LICENSE.txt,sha256=VR2hkz3p9Sw4hSXc7S5iZTOXGeV4h-i8AO_q0zEmtkE,1074
|
51
|
+
tariochbctools-0.38.1.dist-info/METADATA,sha256=QH4ZUYd9YoyXEbWc2f3in6HLQtlXtf-o2kfSi3iw_a8,2104
|
52
|
+
tariochbctools-0.38.1.dist-info/WHEEL,sha256=AHX6tWk3qWuce7vKLrj7lnulVHEdWoltgauo8bgCXgU,109
|
53
|
+
tariochbctools-0.38.1.dist-info/entry_points.txt,sha256=9xrCCY1wx2zCIsQUOWZelLHDmHw9Oc-ZBAKUIY9lKTA,88
|
54
|
+
tariochbctools-0.38.1.dist-info/top_level.txt,sha256=CiA_NepCI6zDNsaORA55zmpuJFSnTvLESraIL13xiOQ,15
|
55
|
+
tariochbctools-0.38.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|