From 8ad16c8b8ffb08ba94ce50c9a998474b0d41e84a Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Wed, 19 Jun 2024 11:39:16 -0500 Subject: [PATCH] add sync-banks script --- README.md | 20 ++++++++++++++++++-- sync-banks.js | 13 +++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 sync-banks.js diff --git a/README.md b/README.md index 4fdca37..3a44bbb 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ This is a collection of useful scripts to help you manage your Actual Budget. - [Configuration](#configuration) - [Installation](#installation) - Scripts: - - [Loan Interest Calculator](#loan-interest-calculator) - - [Tracking Home Prices (Zillow's Zestimate)](#tracking-home-prices-zillows-zestimate) + - [Sync Remote Banks](#sync-remote-banks) + - [Loan Interest Calculator](#loan-interest-calculator) + - [Tracking Home Prices (Zillow's Zestimate)](#tracking-home-prices-zillows-zestimate) ## Requirements @@ -46,6 +47,21 @@ Note that most of the scripts utilize account notes to set configuration on each account. The scripts will find all accounts that are configured and update them all in a single call. +### Sync Remote Banks + +This script will sync all remote banks that are configured in Actual Budget. +This can be used in place of clicking the "Sync" button in the Actual Budget +app and will ensure your accounts are always up-to-date with +GoCardless/SimpleFIN. + +To run: + +```console +$ node sync-banks.js +``` + +It is recommended to run this script once per day or week. + ### Loan Interest Calculator This script calculates the interest for a loan account and adds the interest diff --git a/sync-banks.js b/sync-banks.js new file mode 100644 index 0000000..e809aab --- /dev/null +++ b/sync-banks.js @@ -0,0 +1,13 @@ +// Script to run all bank syncs +// Useful for running bank syncs on a daily/weekly schedule +const { closeBudget, openBudget } = require('./utils'); +const api = require('@actual-app/api'); + +(async () => { + await openBudget(); + + console.log("syncing banks..."); + await api.runBankSync(); + + await closeBudget(); +})();