Skip to main content

Beancount Importer for Nordnet DK CSV exports

Project description

Beancount Nordnet DK Importer

beancount-nordnetdk provides an importer for converting CSV exports of Nordnet transaction summaries to the Beancount format.

Installation

$ pip install beancount-nordnetdk

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

If you're not familiar with how to import external data into Beancount, please read this guide first.

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:

from beancount_nordnetdk import NordnetDKImporter
from beangulp import Ingest

importers = (
    NordnetDKImporter(
        depot_accounts={
            "12345678": "Assets:Nordnet:Account1",
            "23456789": "Assets:Nordnet:Account2",
            "34567890": "Assets:Nordnet:Account3",
        },
        currency="DKK",
        stock_account="Assets:Nordnet:Stocks",
        fees_account="Expenses:Investments:Fees",
        dividend_account="Income:Investments:Dividends",
        tax_account="Expenses:Investments:Tax",
        interest_account="Income:Investments:Interest",
    ),
)

if __name__ == "__main__":
    ingest = Ingest(importers)
    ingest()

... and run it directly using python import.py extract.

Beancount 2.x

Adjust your config file to include NordnetDKImporter.

Add the following to your config.py:

from beancount_nordnetdk import NordnetDKImporter

CONFIG = [
    NordnetDKImporter(
        depot_accounts={
            "12345678": "Assets:Nordnet:Account1",
            "23456789": "Assets:Nordnet:Account2",
        },
        currency="DKK",
        stock_account="Assets:Nordnet:Stocks",
        fees_account="Expenses:Investments:Fees",
        dividend_account="Income:Investments:Dividends",
        tax_account="Expenses:Investments:Tax",
        interest_account="Income:Investments:Interest",
    ),
]

Once this is in place, you should be able to run bean-extract on the command line to extract the transactions and pipe all of them into your Beancount file.

$ bean-extract /path/to/config.py transactions-and-notes-export.csv >> you.beancount

CSV Format

The importer expects Nordnet CSV exports with the following characteristics:

  • Filename: transactions-and-notes-export.csv
  • Encoding: UTF-16
  • Separator: Tab (\t)
  • Header row: Present

Key columns:

  • Id - 10 digit transaction ID
  • Bogføringsdag - Posting date (yyyy-mm-dd)
  • Handelsdag - Trade date (yyyy-mm-dd)
  • Valørdag - Value date (yyyy-mm-dd)
  • Depot - Account number (8 digits)
  • Transaktionstype - Transaction type
  • Værdipapirer - Security name
  • ISIN - ISIN identifier
  • Antal - Quantity
  • Kurs - Price
  • Samlede afgifter - Total fees
  • Beløb - Amount
  • Valuta - Currency
  • Saldo - Account balance
  • Transaktionstekst - Transaction text
  • Kurtage - Brokerage

Contributing

Contributions are most welcome!

Please make sure you have Python 3.11+ and uv installed.

  1. Clone the repository: git clone https://github.com/joandrsn/beancount-nordnetdk
  2. Install the packages required for development: uv sync --dev
  3. That's basically it. You should now be able to run the test suite: uv run pytest.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beancount_nordnetdk-1.0.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beancount_nordnetdk-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file beancount_nordnetdk-1.0.0.tar.gz.

File metadata

  • Download URL: beancount_nordnetdk-1.0.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.23 {"installer":{"name":"uv","version":"0.9.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for beancount_nordnetdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cb11a366bce2c45caa917f8555819a30c5f1181db65a6af0560f3aee0c3554a6
MD5 525f07220c3661b36fc7eb83f1cee371
BLAKE2b-256 2e8221c6d9900cfa77446ac1d8c89717bd0b046f8d4130c78a49990d9a5f87bc

See more details on using hashes here.

File details

Details for the file beancount_nordnetdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: beancount_nordnetdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.23 {"installer":{"name":"uv","version":"0.9.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for beancount_nordnetdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32cc6fe16f0e0f5e60bc5a59fa9aff04a61bafc5aacee4bcdecf9dcd2b4c25d2
MD5 c0e2e3f3000322e3465018f434c4b858
BLAKE2b-256 2346c456f4412c572ac0f16373812e90c6d4063119f648b4c036b2df916b58f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page