Skip to content

Instantly share code, notes, and snippets.

@jlongster
Created August 8, 2019 18:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlongster/6c04de7117780efb3c6c7a2887363e19 to your computer and use it in GitHub Desktop.
Save jlongster/6c04de7117780efb3c6c7a2887363e19 to your computer and use it in GitHub Desktop.
let actual = require('@actual-app/api');
async function run() {
let accounts = await actual.getAccounts();
let accountId = accounts[0].id;
let transactions = [];
for (let i = 0; i < 10; i++) {
transactions.push({
payee: 'Payee ' + ((Math.random() * 10) | 0),
amount: (-Math.random() * 10000) | 0,
date: '2019-08-18'
});
}
await actual.importTransactions(accountId, transactions);
}
actual.runWithBudget('My-Stash2', run);
let actual = require('@actual-app/api');
async function run() {
let categories = await actual.getCategories({ asList: true });
for (let category of categories) {
if (!category.is_income) {
await actual.setBudgetAmount(
'2019-08',
category.id,
(Math.random() * 10000) | 0
);
}
}
}
actual.runWithBudget('My-Stash2', run);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment