https://github.com/ericbf/ynab-negative-rollover
Rollover your negative YNAB balances!
https://github.com/ericbf/ynab-negative-rollover
budget budgeting nodejs rollover typescript ynab ynab-api
Last synced: 15 days ago
JSON representation
Rollover your negative YNAB balances!
- Host: GitHub
- URL: https://github.com/ericbf/ynab-negative-rollover
- Owner: ericbf
- License: mit
- Created: 2019-12-04T04:06:48.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-09T03:24:48.000Z (about 1 year ago)
- Last Synced: 2025-06-03T23:11:34.182Z (9 months ago)
- Topics: budget, budgeting, nodejs, rollover, typescript, ynab, ynab-api
- Language: TypeScript
- Homepage:
- Size: 158 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YNAB Negative Rollover
A script that enables you to rollover your negative balances in
[YNAB](https://www.youneedabudget.com). I've contacted YNAB support multiple times to
support this natively – they basically said they don't want to (stupid!). So I did it
myself using their [API](https://api.youneedabudget.com). It's hacky, but it works for my
family. The one downside that I don't really have a workaround for is that it messes up
the “activity” total for a category with a rollover amount, as the rollover amount is
rendered as a transaction. Just filter out the rollover category in your reports.
## Dependencies
This has a global dependency on [`node`](http://nodejs.org). Also, we use `pnpm` as
the package manager in this project.
## Initializing
To install local dependencies, run `pnpm i`. Make sure you are providing the app your API
token, otherwise it will not work. Do this via an `env.local` file at project root.
You should create a payee called `Budget Rollover`, an account called `Budget Rollover`,
and a category called `Rollover Offset`. You can set the initial balance of the account to
zero and close it right away, and you can also hide the category after creating it.
### Parameters
You can pass parameters in the command line when running this, or via `.env` files.
- `TOKEN`: your YNAB API token. This can also be added in an `index.token` file at the
root of `src`.
- `BUDGET_ID`: the ID of the budget that you want to apply this to. Defaults to
`"last-used"`.
- `ROLLOVER_PAYEE`: the payee to use for the rollover transactions. Defaults to `"Budget
Rollover"`.
- `ROLLOVER_ACCOUNT`: the account to use for the rollover transactions. Defaults
to `"Budget Rollover"`.
- `ROLLOVER_CATEGORY`: the category to use for the rollover
transactions. Defaults to `"Rollover Offset"`.
- `INFLOWS_CATEGORY`: the name of the inflows
category. Defaults to `"Inflows"`.
- `PAYMENTS_GROUP`: the name of the credit card payments group. Defaults to `"Credit Card
Payments"`.
- `GROUPS_TO_OFFSET`: the comma separated names of the category groups that should be
offset in the to be budgeted account (such as business expenses). Defaults to
`"Unbudgeted"`.
## Running
This can be run with `node --env-file=.env [--env-file=.env.local] .
[schedule|apply|market-value|zero|clear]`.
> Before you run make sure you build it with `pnpm build`.
- `schedule`: starts a daemon in the foreground to run apply every 2 minutes.
- `apply`: runs the script to apply the rollover amounts to your budget.
- `market-value`: checks the latest market value of currencies that are noted in account
notes and updates the account balance based on that value.
- `zero`: runs the script that zeros out all existing rollover transactions.
- `clear`: clears the local cache of saved IDs and transactions.
## Development
You can run the app with livereload enabled by running `pnpm watch`.