tariochbctools 0.37__tar.gz → 0.38.1__tar.gz

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.
Files changed (91) hide show
  1. {tariochbctools-0.37/src/tariochbctools.egg-info → tariochbctools-0.38.1}/PKG-INFO +1 -1
  2. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/nordigen/importer.py +7 -3
  3. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/revolut/importer.py +43 -20
  4. {tariochbctools-0.37 → tariochbctools-0.38.1/src/tariochbctools.egg-info}/PKG-INFO +1 -1
  5. {tariochbctools-0.37 → tariochbctools-0.38.1}/.coveragerc +0 -0
  6. {tariochbctools-0.37 → tariochbctools-0.38.1}/.isort.cfg +0 -0
  7. {tariochbctools-0.37 → tariochbctools-0.38.1}/.pre-commit-config.yaml +0 -0
  8. {tariochbctools-0.37 → tariochbctools-0.38.1}/.readthedocs.yml +0 -0
  9. {tariochbctools-0.37 → tariochbctools-0.38.1}/LICENSE.txt +0 -0
  10. {tariochbctools-0.37 → tariochbctools-0.38.1}/MANIFEST.in +0 -0
  11. {tariochbctools-0.37 → tariochbctools-0.38.1}/README.rst +0 -0
  12. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/_static/.gitignore +0 -0
  13. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/conf.py +0 -0
  14. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/importers.rst +0 -0
  15. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/index.rst +0 -0
  16. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/installation.rst +0 -0
  17. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/license.rst +0 -0
  18. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/plugins.rst +0 -0
  19. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/price_fetchers.rst +0 -0
  20. {tariochbctools-0.37 → tariochbctools-0.38.1}/docs/requirements.txt +0 -0
  21. {tariochbctools-0.37 → tariochbctools-0.38.1}/pyproject.toml +0 -0
  22. {tariochbctools-0.37 → tariochbctools-0.38.1}/setup.cfg +0 -0
  23. {tariochbctools-0.37 → tariochbctools-0.38.1}/setup.py +0 -0
  24. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/__init__.py +0 -0
  25. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/__init__.py +0 -0
  26. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/bcge/__init__.py +0 -0
  27. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/bcge/importer.py +0 -0
  28. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/bitst/__init__.py +0 -0
  29. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/bitst/importer.py +0 -0
  30. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/blockchain/__init__.py +0 -0
  31. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/blockchain/importer.py +0 -0
  32. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/cembrastatement/__init__.py +0 -0
  33. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/cembrastatement/importer.py +0 -0
  34. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/general/__init__.py +0 -0
  35. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/general/mailAdapterImporter.py +0 -0
  36. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/general/mt940importer.py +0 -0
  37. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/general/priceLookup.py +0 -0
  38. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/ibkr/__init__.py +0 -0
  39. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/ibkr/importer.py +0 -0
  40. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/neon/__init__.py +0 -0
  41. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/neon/importer.py +0 -0
  42. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/netbenefits/__init__.py +0 -0
  43. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/netbenefits/importer.py +0 -0
  44. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/nordigen/__init__.py +0 -0
  45. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/nordigen/nordigen_config.py +0 -0
  46. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/postfinance/__init__.py +0 -0
  47. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/postfinance/importer.py +0 -0
  48. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/quickfile/__init__.py +0 -0
  49. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/quickfile/importer.py +0 -0
  50. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/raiffeisench/importer.py +0 -0
  51. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/revolut/__init__.py +0 -0
  52. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/schedule/__init__.py +0 -0
  53. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/schedule/importer.py +0 -0
  54. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/swisscard/__init__.py +0 -0
  55. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/swisscard/importer.py +0 -0
  56. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/transferwise/__init__.py +0 -0
  57. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/transferwise/importer.py +0 -0
  58. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/truelayer/__init__.py +0 -0
  59. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/truelayer/importer.py +0 -0
  60. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/viseca/__init__.py +0 -0
  61. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/viseca/importer.py +0 -0
  62. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/zak/__init__.py +0 -0
  63. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/zak/importer.py +0 -0
  64. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/zkb/__init__.py +0 -0
  65. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/importers/zkb/importer.py +0 -0
  66. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/plugins/__init__.py +0 -0
  67. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/plugins/check_portfolio_sum.py +0 -0
  68. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/plugins/generate_base_ccy_prices.py +0 -0
  69. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/plugins/prices/__init__.py +0 -0
  70. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools/plugins/prices/ibkr.py +0 -0
  71. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools.egg-info/SOURCES.txt +0 -0
  72. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools.egg-info/dependency_links.txt +0 -0
  73. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools.egg-info/entry_points.txt +0 -0
  74. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools.egg-info/not-zip-safe +0 -0
  75. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools.egg-info/requires.txt +0 -0
  76. {tariochbctools-0.37 → tariochbctools-0.38.1}/src/tariochbctools.egg-info/top_level.txt +0 -0
  77. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/__init__.py +0 -0
  78. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/conftest.py +0 -0
  79. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/__init__.py +0 -0
  80. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/importers/__init__.py +0 -0
  81. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/importers/test_quickfile.py +0 -0
  82. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/importers/test_truelayer.py +0 -0
  83. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/__init__.py +0 -0
  84. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/data/generate_base_ccy_prices/entry_already_exists_expected.beancount +0 -0
  85. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/data/generate_base_ccy_prices/entry_already_exists_input.beancount +0 -0
  86. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/data/generate_base_ccy_prices/missing_fx_expected.beancount +0 -0
  87. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/data/generate_base_ccy_prices/missing_fx_input.beancount +0 -0
  88. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/data/generate_base_ccy_prices/normal_expected.beancount +0 -0
  89. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/data/generate_base_ccy_prices/normal_input.beancount +0 -0
  90. {tariochbctools-0.37 → tariochbctools-0.38.1}/tests/tariochbctools/plugins/test_generate_base_ccy_prices.py +0 -0
  91. {tariochbctools-0.37 → tariochbctools-0.38.1}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tariochbctools
3
- Version: 0.37
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
@@ -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
- metakv = {
61
- "nordref": trx["transactionId"],
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
- row["Description"].strip(),
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
- # only add balance after the last (newest) transaction
75
- try:
76
- book_date = book_date + timedelta(days=1)
77
- entry = data.Balance(
78
- data.new_metadata(file.name, 0, {}),
79
- book_date,
80
- self.account,
81
- balance,
82
- None,
83
- None,
84
- )
85
- entries.append(entry)
86
- except NameError:
87
- pass
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.37
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
File without changes
File without changes
File without changes