Meta - afaneca/myfin GitHub Wiki

Overview

Coming soon...

Users

Coming soon...

Accounts

Types of account

Myfin currently supports these account types:

code type
CHEAC Checking account
SAVAC Savings account
CREAC Credit card or loan
INVAC Investment account
MEALAC Meal card or allowance
WALLET Cash

As of right now, this attribute is only meaningful in a presentation layer (in the way accounts are organized in the accounts list), but might have a more impactful role in the future.

Exclude from budgets attribute

One important account attribute to keep in check is the exclude from budgets toggle. If you toggle it on for an account, all transfer transactions that have that specific account marked as the recipient will be treated as an expense when it comes to budget calculations and analysis (see here).

As a generic rule of thumb, I recommend you toggle this attribute on for all your credit cards and loan accounts.

Here's my reasoning: everytime you make a car payment, for instance, you're actually making a transfer from your checking account to your car loan account (minus premiums). However, even though it's not technically an expense, you may still want to treat it as such, since it's still money that's going to be debited from your account and that you need to account for (like any other fixed expense).

By marking the car loan account as "exclude from budget", you're telling MyFin to treat all transfers to that account as if they were expenses (for budgeting purposes only).

Transactions

Transactions can be of type:

  • Income/Credit
  • Expense/Debit
  • Transfer (between own accounts)

In logical terms, a transfer from A -> B is treated by the API as two different transactions:

  1. X amount is debited from A
  2. X amount is credited in B

However, for accessibility and data integrity, they're still stored as a single entry.

Here's a typical DB representation of 3 different transactions: 1 debit, 1 credit and 1 transfer (simplified and truncated):

transaction_id type accounts_account_from_id accounts_account_to_id description
1 E 101 NULL debit from #101
2 I NULL 101 credit to #101
3 T 101 102 transfer from #101 to #102

Categories

Coming soon...

Entities

Coming soon...

Budgets

Coming soon...

Investment Accounts

Coming soon...

Investment Transactions

Coming soon...

Balance Snapshots

As the months go by, MyFin keeps track of your accounts balances so that it can help you visualize and analyse how your patrimony grows over time.

A technical method for making this work would be to setup cron jobs so that we could fetch all account balances at regular intervals and store that info on the database.

However, as to avoid having to depend on job schedulers, I decided to implement a more passive, on-demand approach: every time a new transaction is added, removed or updated, the API will fetch the current balances for the accounts involved in that transaction and will then create or update the snapshot for those accounts in that specific month in the DB. If the transactions month is not the current month, then it'll also recalculate the snapshots for all months between then and now.

FAQ

Why do the values from the budget details differ from the evolution stats?

The month's balance value is calculated differently in the evolution stats compared to the budget details.

In the budget details:

  • Only transactions associated with a category are accounted for
  • Transfers for accounts marked as "exclude from budget" are treated as expenses (e.g. loan repayment)
  • It gives a more practical view of how your expenses compare to your income (for instance, loan repayments, apart from premiums, are actually contributing and adding to your patrimony. However, in practical terms, they still represent an immediate expense that needs to be covered by your income, like any other)

In the evolution stats:

  • Doesn't look through the transactions
  • Instead, it looks at balance snapshots for all accounts at the beggining of the month and compares them with snapshots from the end of the month. The difference in terms of totals represents the month's balance
  • It provides a more realistic view of how your patrimony grew (or not) in that specific month

If you see discrepancies between both values, it might be because:

  • You have uncategorized transactions
  • You have transfers to accounts marked as "exclude from budget" (e.g. loan repayment)