Skip to main content

Importers, plugins and price fetchers for Beancount

Project description

https://img.shields.io/pypi/l/tariochbctools.svg https://img.shields.io/pypi/v/tariochbctools.svg

tariochbctools

Some importers, plugins and price fetchers for the double-entry bookkeeping software Beancount.

Install it with

pip install tariochbctools

plugins

generate_base_ccy_prices

Dynamically generates prices to the base ccy by applying the fx rate to the base ccy for non base ccy prices

plugin "tariochbctools.plugins.generate_base_ccy_prices" "CHF"

price fetchers

alphavantage

Fetches prices from Alphavantage Requires the environment variable ALPHAVANTAGE_API_KEY to be set with your personal api key.

2019-01-01 commodity VWRL
  price: "CHF:tariochbctools.plugins.prices.alphavantage/VWRL.SW"

alphavantagefx

Fetches fx rates from Alphavantage Requires the environment variable ALPHAVANTAGE_API_KEY to be set with your personal api key.

2019-01-01 commodity BTC
  price: "CHF:tariochbctools.plugins.prices.alphavantagefx/BTC"

bitstamp

Fetches prices from Bitstamp

2019-01-01 commodity BTC
  price: "EUR:tariochbctools.plugins.prices.bitstamp/BTC"

exchangeratesapi

Fetches prices from ratesapi.io

2019-01-01 commodity EUR
  price: "CHF:tariochbctools.plugins.prices.exchangeratesapi/EUR"

interactivebrokers

Fetches prices from interactivebrokers Only works if you have open positions with the symbols. Requires the environment variables IBKR_TOKEN to be set with your flex query token and IBKR_QUERY_ID with a flex query that contains the open positions.

2019-01-01 commodity VWRL
  price: "CHF:tariochbctools.plugins.prices.ibkr/VWRL"

coinmarketcap

Fetches prices from coinmarketcap Requires the environment variable COINMARKETCAP_API_KEY to be set to your api key.

2019-01-01 commodity BTC
  price: "CHF:tariochbctools.plugins.prices.coinmarketcap/BTC"

importers

bitstamp

Import transactions from Bitstamp

Create a file called bitstamp.yaml in your import location (e.g. downloads folder).

username: "12345"
key: "MyKey"
secret: "MySecret"
account: 'Assets:Bitstamp'
otherExpensesAccount: 'Expenses:Fee'
capGainAccount: 'Income:Capitalgain'
monthCutoff: 3
currencies:
  - eur
  - btc
from tariochbctools.importers.bitst import importer as bitstimp
CONFIG = [bitstimp.Importer()]

revolut

Import CSV from Revolut

from tariochbctools.importers.revolut import importer as revolutimp
CONFIG = [revolutimp.Importer('/Revolut-CHF.*\.csv', 'Assets:Revolut:CHF', 'CHF')]

transferwise

Import from Transferwise using their api

from tariochbctools.importers.transferwise import importer as twimp
CONFIG = [twimp.Importer()]

Create a file called transferwise.yaml in your import location (e.g. download folder).

token: <your api token>
baseAccount: <Assets:Transferwise:>

TrueLayer

Import from TrueLayer using their api services. e.g. supports Revolut. You need to create a dev account and see their documentation about how to get a refresh token.

from tariochbctools.importers.truelayer import importer as tlimp
CONFIG = [tlimp.Importer()]

Create a file called truelayer.yaml in your import location (e.g. download folder).

baseAccount: <Assets:MyBank:>
client_id: <CLIENT ID>
client_secret: <CLIENT SECRET>
refresh_token: <REFRESH TOKEN>

zkb

Import mt940 from Zürcher Kantonalbank

from tariochbctools.importers.zkb import importer as zkbimp
CONFIG = [zkbimp.ZkbImporter('/\d+\.mt940', 'Assets:ZKB')]

ibkr

Import dividends from Interactive Brokers

Create a file called ibkr.yaml in your import location (e.g. downloads folder).

token: <flex web query token>
queryId: <flex query id>
baseCcy: CHF

zak

Currently not working reliably. Import PDF from Bank Cler ZAK

mt940

Import Swift mt940 files.

schedule

Generate scheduled transactions.

Define a file called schedule.yaml in your import location (e.g. downloads folder). That describes the schedule transactions. They will be added each month at the end of the month.

transactions:
  - narration: 'Save'
    postings:
        - account: 'Assets:Normal'
          amount: '-10'
          currency: CHF
        - account: 'Assets:Saving'
from tariochbctools.importers.schedule import importer as scheduleimp
CONFIG = [ scheduleimp.Importer() ]

Cembra Mastercard Montly Statement

Import Monthly Statement PDF from Cembra Money Bank (e.g. Cumulus Mastercard). Requires the dependencies for camelot to be installed. See https://camelot-py.readthedocs.io/en/master/user/install-deps.html#install-deps

from tariochbctools.importers.cembrastatement import importer as cembrastatementimp
CONFIG = [cembrastatementimp.Importer('\d+.pdf', 'Liabilities:Cembra:Mastercard')]

blockchain

Import transactions from Blockchain

Create a file called blockchain.yaml in your import location (e.g. downloads folder).

base_ccy: CHF
addresses:
  - address: 'SOMEADDRESS'
    currency: 'BTC'
    narration: 'Some Narration'
    asset_account: 'Assets:MyCrypto:BTC'
  - address: 'SOMEOTHERADDRESS'
    currency: 'LTC'
    narration: 'Some Narration'
    asset_account: 'Assets:MyCrypto:LTC'
from tariochbctools.importers.blockchain import importer as bcimp
CONFIG = [bcimp.Importer()]

mail adapter

Instead of expecting files to be in a local directory. Connect per imap to a mail account and search for attachments to import using other importers.

Create a file called mail.yaml in your import location (e.g. downloads folder).

host: "imap.example.tld"
user: "myuser"
password: "mypassword"
folder: "INBOX"
targetFolder: "Archive"

The targetFolder is optional, if present, mails that had attachments which were valid, will be moved to this folder.

from tariochbctools.importers.general.mailAdapterImporter import MailAdapterImporter
CONFIG = [MailAdapterImporter([MyImporter1(), MyImporter2()])]

Syncing a fork

Details: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/syncing-a-fork

git remote add upstream https://github.com/tarioch/beancounttools.git
git remote -v
git fetch upstream
git checkout master
git merge upstream/master
git push

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

tariochbctools-0.16.1.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

tariochbctools-0.16.1-py2.py3-none-any.whl (26.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tariochbctools-0.16.1.tar.gz.

File metadata

  • Download URL: tariochbctools-0.16.1.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for tariochbctools-0.16.1.tar.gz
Algorithm Hash digest
SHA256 0f21369667b2b93a0a33f0e8d74f4824cc1e5a8766c9058016fb249b6144f59c
MD5 4e87c584786f71bd03043c6a8e4ac941
BLAKE2b-256 a88a41abbe83f17b869a8026142eab15c9b9dc19868d4da6e5c388a33a154024

See more details on using hashes here.

File details

Details for the file tariochbctools-0.16.1-py2.py3-none-any.whl.

File metadata

  • Download URL: tariochbctools-0.16.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for tariochbctools-0.16.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5ae5e7a80bdcc16dc6f5d3b46a0daf2ccde3e8768de9b967790814a0bcfb0fc1
MD5 fe7853c15c91f896b1aa37fd2c753117
BLAKE2b-256 b6aa91ff1da245f822c17fa87ba5aa2e9622b06747f397c4b0f4ca6b5c19ca41

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