https://github.com/siddhantgoel/beancount-n26
Beancount Importers for N26 CSV Exports
https://github.com/siddhantgoel/beancount-n26
accounting banking beancount finance germany n26 personal-finance plaintext-accounting python python3
Last synced: about 1 year ago
JSON representation
Beancount Importers for N26 CSV Exports
- Host: GitHub
- URL: https://github.com/siddhantgoel/beancount-n26
- Owner: siddhantgoel
- License: mit
- Created: 2019-10-21T19:51:58.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T17:30:15.000Z (about 2 years ago)
- Last Synced: 2024-05-02T02:15:28.915Z (about 2 years ago)
- Topics: accounting, banking, beancount, finance, germany, n26, personal-finance, plaintext-accounting, python, python3
- Language: Python
- Homepage:
- Size: 290 KB
- Stars: 16
- Watchers: 2
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-beancount - N26
README
# Beancount N26 Importer
[](https://github.com/siddhantgoel/beancount-n26/workflows/beancount-n26/badge.svg)
[](https://pypi.python.org/pypi/beancount-n26)
[](https://pypi.python.org/pypi/beancount-n26)
[](https://github.com/astral-sh/ruff)
`beancount-n26` provides a [Beancount] Importer for converting CSV exports of
[N26] account summaries to the Beancount format.
## Installation
```sh
$ pip install beancount-n26
```
In case you prefer installing from the Github repository, please note that `main` is the
development branch so `stable` is what you should be installing from.
## Usage
### Beancount 3.x
Beancount 3.x has replaced the `config.py` file based workflow in favor of having a
script based workflow, as per the [changes documented here]. The `beangulp` examples
suggest using a Python script based on `beangulp.Ingest`. Here's an example of how that
might work:
Add an `import.py` script in your project root with the following contents:
```python
from beancount_n26 import N26Importer
from beangulp import Ingest
importers = (
N26Importer(
IBAN_NUMBER,
'Assets:N26',
language='en',
file_encoding='utf-8',
),
)
if __name__ == "__main__":
ingest = Ingest(importer)
ingest()
```
... and run it directly using `python import.py extract`.
### Beancount 2.x
Add the following to your `config.py`.
```python
from beancount_n26 import N26Importer
CONFIG = [
N26Importer(
IBAN_NUMBER,
'Assets:N26',
language='en',
file_encoding='utf-8',
),
]
```
### Classification
To classify specific recurring transactions automatically, you can specify an
`account_patterns` parameter. The key should be the account name and the items in the
list are regular expressions that should match a `payee`.
A few helper functions have been provided in
`beancount_n26/utils/patterns_generation.py` to help you generate this dictionnary.
#### Beancount 3.x
```python
from beancount_n26 import N26Importer
from beangulp import Ingest
importers = (
N26Importer(
IBAN_NUMBER,
'Assets:N26',
account_patterns={"Expenses:Supermarket": ["REWE", "ALDI"]}
),
)
if __name__ == "__main__":
ingest = Ingest(importer)
ingest()
```
#### Beancount 2.x
```python
from beancount_n26 import N26Importer
CONFIG = [
N26Importer(
...
account_patterns={"Expenses:Supermarket": ["REWE", "ALDI"]}
),
]
```
## Contributing
Please make sure you have Python 3.9+ and [Poetry] installed.
1. Git clone the repository -
`git clone https://github.com/siddhantgoel/beancount-n26`
2. Install the packages required for development -
`poetry install`
3. That's basically it. You should now be able to run the test suite -
`poetry run task test`.
[Beancount]: http://furius.ca/beancount/
[N26]: https://n26.com/
[Poetry]: https://python-poetry.org/
[changes documented here]: https://docs.google.com/document/d/1O42HgYQBQEna6YpobTqszSgTGnbRX7RdjmzR2xumfjs/edit#heading=h.hjzt0c6v8pfs