Skip to main content

Elv

Wheel Status

Elv is a small module for parsing bank transactions from CSV files and performing queries on the data.

Supported formats

It currently supports the banks who use the Eike Alliance solution. These include, but are not limited to

  • Jæren Sparebank

  • Sandnes Sparebank

but I’ll add support for other banks whenever I get an example dump of their format. Send pull requests if you have them at https://github.com/cslarsen/elv/.

Sandnes Sparebank used to have another format, and I’ve kept it here, although I’m not sure anyone uses that anymore.

Norwegian short description

Elv er en Python modul for å lese banktransaksjoner eksportert fra banken din som en CSV-fil.

Foreløpig er det kun støtte for å lese filer fra Jæren Sparebank og Sandnes Sparebank. For å eksportere transaksjoner for en konto, velg et datointervall og deretter i øverste høyre ikon velger du “eksporter til fil”.

Jeg har sett at andre nettbanker har tilsvarende funksjonalitet, så send meg gjerne eksempler på andre format så skal jeg legge dem til.

Features

  • Parses CSV file from bank containing transactions

  • Money is stored in exact decimals

  • Contains a simple Python query API for sorting through large collections of transactions.

  • Can optionally put transactions in an in-memory SQLite3 database for even better queries.

Elevator pitch

Here’s how easy it is to use elv:

>>> from datetime import date
>>> import elv
>>> trans = elv.parse("data.csv")
>>> trans
<Transactions:453 items from 2009-01-27 to 2015-03-20>
>>> trans[0].amount
Decimal('300.00')
>>> trans.range(date(2015,1,1), date(2015,3,1))
<Transactions:15 items from 2015-01-02 to 2015-02-20>
>>> trans.range(date(2015,1,1), date(2015,3,1)).total()
Decimal('4500.00')

Installation

You can install from setup.py:

$ python setup.py install # you may have to run as sudo

or from PyPI:

$ pip install elv

Example usage

If you have the bank account transactions in a file called data.csv, you can simply do:

$ python
>>> import elv
>>> transactions = elv.parse("data.csv")
>>> transactions
<Transactions:400 items from 2009-01-27 to 2014-09-29>
>>> transactions[0]
<Transaction:2014-09-29 2014-09-29 -2677.00  29519.13 'Vacation'>
>>> transactions[0].xfer
datetime.date(2014, 9, 29)
>>> transactions[0].posted
datetime.date(2014, 9, 29)
>>> transactions[0].amount
Decimal('-2677.00')

You can also get an in-memory SQLite3 database by doing:

>>> db = transactions.to_sqlite3()
>>> db
<sqlite3.Connection object at 0x10f31e200>
>>> db.execute("SELECT * FROM Transactions").next()
(0, datetime.date(2014, 9, 29), datetime.date(2014, 9, 29),
 u'Vacation', Decimal('-2677'), Decimal('29519.13'))

How to parse other formats

To parse the default format, Jæren Sparebank:

>>> ts = elv.parse("file.csv", format="Jæren Sparebank")

To parse Sandnes Sparebank:

>>> ts = elv.parse("file.txt", format="Sandnes Sparebank")

To see a list of formats, see the dictionary elv.formats.

The CSV File Format: Jæren Sparebank

The CSV file should be a plain text file with the ISO-8859-1 encoding (aka Latin1). It looks like this:

"31-12-2014";"31-12-2014";"Test 1";"-497,78";"5.520,09"
"30-12-2014";"31-12-2014";"Test 2";"-100,00";"6.017,87"
"30-12-2014";"31-12-2014";"Test 3 --æøåÆØÅ--";"-145,47";"6.117,87"
"30-12-2014";"30-12-2014";"Test 4";"-457,24";"6.263,34"
"29-12-2014";"29-12-2014";"Test 5";"-108,30";"6.720,58"

The fields are as follows:

  • Date when the transaction was placed, in format "DD-MM-YYYY".

  • Date when the transaction was posted (“bokført”).

  • A message associated with the transaction, set by the one making the transaction.

  • The amount deposited or deducted from the account in NOK (Norwegian kroner) in format "-123,45", always two decimals and an optional sign.

  • The balance of your account after this transaction was completed.

The file itself contains no headers, and can contain many such transactions, one per line.

License

Copyright 2015, 2016 Christian Stigen Larsen

Licensed under Affero GPL v3 or later; see http://www.gnu.org/licenses/agpl-3.0.html

Release files for elv 1.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elv 1.0.12
File Size Uploaded
elv-1.0.12.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elv 1.0.12
File Interpreter ABI Platform
elv-1.0.12-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 32.8 kB

Release files / elv-1.0.12.tar.gz

Download URL elv-1.0.12.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fdce4e378227e319bfe6ad3abc0f3a2803b1f33a7fedf94a3ae1d225ab1690be
BLAKE2b-256 checksum
How to use checksums
30b823e0257a0b8003c0e0aa4d8a7595291278573e95f10ffacf83a248f7233c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / elv-1.0.12-py2.py3-none-any.whl

Download URL elv-1.0.12-py2.py3-none-any.whl
Size 10.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2ac51b8d05f75b67869558e12a42209e502a4d7d537a1abda641275c39e28869
BLAKE2b-256 checksum
How to use checksums
719258b653e472be8d7a9a0c46fd48d5977f7029bec14cf604d74f5a06174eba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0.14

2 release files

1.0.13

2 release files

This release

1.0.12 This release

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page