Simple command line tool that you'd use in a scheduled task to download bank transactions.
- ANZ
(that's it for now, but feel free to add more!)
- create a example config and download the playwright patched browsers with
bank-downloader init
- edit the config file
- run
bank-downloader download
bank-downloader
makes use of chromedp to automate a real browser.
This means you need to have google chrome, or chromium installed on your system.
bank-downloader
uses a YAML config file to describe the jobs to run.
Each job should describe a single institution and login details, and a list of accounts to download. It is assumed that each account will be downloaded to a separate file.
The config file is located at ~/.bank-downloader/config.yaml
by default.
---
sources:
- name: "anz"
exportFormat: "AgriBank (CSV)"
outputTemplate: "mybank-firstuser-{{.Account.NameSlug}}-{{.Account.NumberSlug}}-{{.FromDateUnix}}-{{.ToDateUnix}}.csv"
daysToFetch: 7
credentials:
type: file
username: "myusername"
password: "mypassword"
accounts:
- name: "My Everyday Cash Account Name"
number: "123456789"
- name: "anz"
exportFormat: "Agrimaster(CSV)"
outputTemplate: "mybank-seconduser-{{.Account.NameSlug}}-{{.Account.NumberSlug}}-{{.FromDateUnix}}-{{.ToDateUnix}}.csv"
daysToFetch: 7
credentials:
type: file
username: "my-other-username"
password: "my-other-password"
accounts:
- name: "My Offset Account Name"
number: "123456789"
- name: "My Fixed Rate Mortage Account Name"
number: "123456789"
Sources where bankdownloader can download transactions from.
The name of the bank to download from. Currently only anz
is supported.
The format of the downloaded file. Supported formats depends on the source.
For reference, the ANZ source supports:
Microsoft Money(OFC)
MYOB(OFX)
MYOB(QIF)
Quicken(OFX)
Quicken(QIF)
Microsoft Excel(CSV)
Agrimaster(CSV)
Phoenix Gateway(CSV)
The template to use for the output file name.
example: mybank-firstuser-{{.Account.NameSlug}}-{{.Account.NumberSlug}}-{{.FromDateUnix}}-{{.ToDateUnix}}.csv
The following variables are available:
{{.Source}}
- the name of the source{{.SourceSlug}}
- the name of the source, with spaces replaced with dashes{{.Account.Name}}
- the name of the account{{.Account.NameSlug}}
- the name of the account, with spaces replaced with dashes{{.Account.Number}}
- the account number{{.Account.NumberSlug}}
- the account number, with spaces replaced with dashes{{.FromDate}}
- the date of the first transaction in the file{{.FromDateSlug}}
- the date of the first transaction in the file, with spaces replaced with dashes{{.FromDateUnix}}
- the date of the first transaction in the file, in unix time{{.ToDate}}
- the date of the last transaction in the file{{.ToDateSlug}}
- the date of the last transaction in the file, with spaces replaced with dashes{{.ToDateUnix}}
- the date of the last transaction in the file, in unix time{{.Now}}
- the current date
The number of days to fetch. Defaults to 7
.
The credentials to use to log in to the bank.
The type of credentials to use to log in to the bank. Currently only file
, gopass
, env
, gopass-otp
, keychain
are supported.
If file
is used, the username and password are read from the username
and password
fields.
If gopass
is used, the username and password are read from gopass using the usernameKey
and passwordKey
fields, and the gopass
binary must be installed.
If env
is used, the username and password are read from environment variables using the usernameKey
and passwordKey
fields.
If gopass-otp
is used, the username, password and otp are read from gopass using the usernameKey
, passwordKey
and otpKey
fields, and the gopass
binary must be installed.
If keychain
is used, the username and password are read from the keychain using the usernameKey
and passwordKey
fields. keychain
is only supported on osx, linux, bsd or windows.
A list of accounts to download.
The name of the account to download.
The number of the account to download.
Creates an example config file at ~/.bank-downloader/config.yaml
.
Downloads transactions for all jobs in the config file.
The path to the config file to use. Defaults to ~/.bank-downloader/config.yaml
.
Whether to run the browser in headless mode. Defaults to true
.
Whether to run the browser in debug mode. Defaults to false
.
The date range mode to use. Defaults to days
.
Options:
days-ago
- use thedaysToFetch
config to calculate the date range, but always download transactions from yesterday to the lastdaysToFetch
days.since-last-download
- uses thedaysToFetch
config to calculate the date range, but always download transactions from the last downloaded transaction date. If the last downloaded transaction date is not available, it will download transactions from yesterday to the lastdaysToFetch
days. If the end date is in the future, it will be set to yesterday.
The idea here is that with a daysToFetch
of 60
, you can set up a scheduled task to run bank-downloader download
every week, and it will:
- on first run download transactions from the last 60 days
- on subsequent runs download transactions from the last 60 days, or since the last downloaded transaction date, whichever is more recent
bank-downloader
automates your installed instance of google chrome.
- logs in to the bank,
- for each account:
- navigates to the accounts page,
- navigates to the transactions page,
- calculates the date range based on the
daysToFetch
config, and the last downloaded transaction date - downloads the transactions for the date range
- saves the transactions to a file, using the
outputTemplate
config - saves the last downloaded transaction date to a file, so that next time it can calculate the date range correctly
see CONTRIBUTING.md