Skip to main content

Automatically sync your bank's data with ledger

Project description

ledger-autosync is a program to pull down transactions from your bank and create ledger transactions for them. It is designed to only create transactions that are not already present in your ledger files. This should make it comparable to some of the automated synchronization features available in products like GnuCash, Mint, etc.

Features

  • supports ledger 3 and hledger

  • like ledger, ledger-autosync will never modify your files directly

  • interactive banking setup via ofxclient [1]

  • multiple banks and accounts

  • import of downloaded OFX files, for banks not supporting automatic download

Platforms

ledger-autosync is developed on Linux with ledger 3; it has been tested on Windows (although it will run slower) and should run on OS X. It requires ledger 3 or hledger, but it should run faster with ledger, because it will not need to start a command to check every transaction.

Quickstart

Install from pip:

$ pip install ledger-autosync

Or install from source:

$ python setup.py install

Run ofxclient to set up banking:

$ ofxclient

When you have added your institution, quit ofxclient.

(At least one user has reported being signed up for a pay service by setting up OFX direct connect. Although this seems unusual, please be aware of this.)

Edit the generated ~/ofxclient.ini file. Change the description field of your accounts to the name used in ledger.

Run:

ledger-autosync

This will download a maximum of 90 days previous activity from your accounts. The output will be in ledger format and printed to stdout. Add this output to your ledger file. When that is done, you can call:

ledger-autosync

again, and it should print nothing to stdout, because you already have those transactions in your ledger.

resync

By default, ledger-autosync will process transactions backwards, and stop when it sees a transaction that is already in ledger. To force it to process all transactions up to the --max days back in time (default: 90), use the --resync option. This can be useful when increasing the --max option. For instance, if you previously synchronized 90 days and now want to get 180 days of transactions, ledger-autosync would stop before going back to 180 days without the --resync option.

Syncing a file

Some banks allow users to download OFX files, but do not support fetching via the OFX protocol. If you have an OFX file, you can convert to ledger:

ledger-autosync /path/to/file.ofx

This will print unknown transactions in the file to stdout in the same way as ordinary sync. If the transaction is already in your ledger, it will be ignored.

How it works

ledger-autosync stores a unique identifier, provided by your institution for each transaction, as metadata in each transaction. When syncing with your bank, it will check if the transaction exists by running the ledger or hledger command. If the transaction exists, it does nothing. If it does not exist, the transaction is printed to stdout.

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

ledger-autosync-0.1.2.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file ledger-autosync-0.1.2.tar.gz.

File metadata

File hashes

Hashes for ledger-autosync-0.1.2.tar.gz
Algorithm Hash digest
SHA256 755c4337c6b95e930e13c862bd1803e61aa5cad52bd3cda182f90bb6e07a8fae
MD5 449a774d0e3bc77a01ff66926b89a9b8
BLAKE2b-256 0b08867f0422ccf12536124d76cc02e55200eda2f83288f83f2a2944d563cc5f

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