Closed aumayr closed 8 years ago
I like the idea of reporting budgets. It's low on my personal list because in my experience, budgets are difficult to maintain in accounting software, and become intuitive and therefore unnecessary once one "practices" personal accounting for a few years. Either way, it can be quite useful until then at least. However, it is a vast topic with much that can be considered.
Representation: a generic way to represent periods (days, weeks, months, quarters, years, etc.) would allow for full flexibility and tweakability. Of course, the obvious is to simply specify dates. Your example would look like:
Expenses:Food:Groceries
2013-12-31 100.00 USD
2016-01-07 120.00 USD
2016-01-14 110.00 USD
2016-02-11 150.00 USD
Shortcuts like your W01 could be accepted as well.
Design: I'd be very wary of putting such things into Fava. I think a solid software separation between accounting and reporting is healthy. Perhaps this is the time to consider making Fava extensible in some way via a plugin/module mechanism. This would be useful in many instances (eg: investment reporting, nice custom reports). For budgets, for example, a beancount plugin to compute the numbers and a corresponding fava plugin to report on the numbers would be one good way to do it.
Report/Display: it would be nice if the budget were represented in your bargraph above. Simpler for leaf accounts, more complicated for non-leaf accounts. Even for leaf accounts, one has to figure out the interaction between reporting periods (months in your bargraph) and the budgeting periods.
Lots to say about budgeting but I don't have that much to add than what I already said on the group. Search the group for previous discussions. IMHO budget is best implemented as a set of constraints (assertions).
I think it's awesome you built a prototype! :-)
(more below)
On Thu, Feb 25, 2016 at 3:15 PM, aumayr notifications@github.com wrote:
Beancount itself is a double-book accounting tool, and does not know of the concept of "budgets".
But the more I use fava I wish there would be a way to display information if a certain account is over budget. I do practice setting budgets for various "accounts" myself to enforce certain spending behavior, and it would be nice to integrate this into the system.
In the "budgeting"-branch I drafted a first version of how this might work and look:
-
There is a new file which contains the budget-rules. It is a simple plain-text-file and has content like this:
Expenses:Food:Groceries 2013-W52 100.00 USD 2016-W01 120.00 USD 2016-W02 110.00 USD 2016-W06 150.00 USD
Expenses:Food:Alcohol 2016-W01 20.00 USD 2016-W02 10.00 USD 2016-W06 5.00 USD
...
The format is very simple: First, the account name ( Expenses:Food:Groceries). Then, lines with the week of the year where this budget applies to (and starts) (2016-W01), and finally the amount and currency (20.00 USD). I will call these lines "Budget entries".
These budget entries represent the budget for the specified week of the year, and all weeks thereafter, until a new rule is set for a week after that. So you can set a budget of 10.00 USD at the very first week of 2015 (2015-W01), and this budget applies to all weeks until a new entry starting in week 5 of that same year (2015-W05) appears and sets the new budget to 20.00 USD.
A budget for a specific account, currency, start-date and end-date is then calculated by stepping through each day in that period, and adding the budget for the week of that day (divided by 7) to the total sum, until the end-date is reached.
I included a test-file in fava/util/test-budget.budget, which contains the rules above for Groceries and Alcohol (accounts in the file generated by bean-example).
You can test it by starting fava with a bean-example-generated file, and navigating to http://localhost:5000/account/Expenses:Food/monthly_changes/ (for example). It should look like this[image: screenshot] https://cloud.githubusercontent.com/assets/5135450/13332840/376008d4-dc04-11e5-9ae6-a756cb5d58af.png
Things to do:
- Discussing if this is a good idea or not
It's certainly a good idea! :-) This is an unoccupied spot in the space of implemented features for Beancount at the moment.
- Discussing if it is to be included in fava or not
- Discussing if the core functionality of this should be factored out into it's own package or should stay within fava
IMHO that feature is closer to the language than to the reporting. It's something you can likely implement "in-between" in a dependency tree, or if we can hash out a nice prototype I'm open to integrating assertions on deltas in Beancount syntax itself. A syntax for assertions, and some error reporting on a failing assertion would in theory be best defined closer to the language, and generating particular reports could live in the reporting UI.
Then again, this can always be done later if you wanted to do that. Maybe it's better to keep the velocity going now and let it bloom while the inspiration is flowing :-)
- Writing tests for the "custom language parser"
Idea: If you want to integrate those rules in the same input file, you could use syntax that parses as comments in Beancount. It's a bit of a lo-fi solution but it could work, e.g. parsing only lines which begin with ;! or whatever.
- The budget is currently "generated" and displayed in the account.html-template, but should ultimately be either part of the API or in a second API ( BudgetAPI?).
What do you think @yagebu https://github.com/yagebu @corani https://github.com/corani @redstreet https://github.com/redstreet @jbms https://github.com/jbms @xentac https://github.com/xentac @blais https://github.com/blais
— Reply to this email directly or view it on GitHub https://github.com/aumayr/fava/issues/165.
@blais - quick OT comment: not sure what you're doing, but the first line of your response paragraphs have the quote character in them, making slightly difficult to read. Seems like your other posts on github also have the same issue. Are you seeing this as well?
I think other users of beancount would be interested in budgeting as well. I think it would be better to add this as an (optional/external) plugin to beancount itself, rather than make it part of fava.
Fava could add this plugin as a dependency and provide a nice UI, but it should be usable without fava as well.
I also had the feeling that this should be a feature of beancount rather than just fava.
Where I am pretty sure now is how it should work:
Set the budget for a specific period (day, week, month, quarter, year), and be able to change it with a new entry with a date after the previous entry, as in my example above.
I can't come up with a situation that this does not cover, from in-period budget changes to periods without a budget (setting it to None after a specific date, until the next budget entry comes along).
What I am still struggling with is how/where it should be implemented. That it should live in/near beancount is clear for me now, but exactly how is open. From your suggestions, and some new ideas of my own:
In the beancount-file, as metadata:
2009-05-05 open Expenses:Food:Groceries
budget: "2015-01-01 monthly 150.00 USD"
budget: "2016-01-01 daily 25.00 USD"
Pro: No change necessary to beancount itself. Accessable by plugins. Con: No real integration with beancount. Errors not along with beancount-errors. Hack-ish.
In the beancount-file, as a new type of directive:
2015-01-01 budget Expenses:Food:Groceries weekly 150.00 USD
Pro: Official support, part of the language, "strongly typed", errors along existing errors. Con: Large change to beancount.
In the beancount-file, as comments:
;budget Expenses:Food:Groceries weekly 150.00 USD
Pro: Quick prototype for beancount possible. Con: Ugly, hack-ish.
If this is to be included in a beancount-file, then the question of organizing is also relevant. I personally like having all budget-related infos next to the Account in one spot, like my example at the top and (1) and like the metadata-solution (2).
Search the group for previous discussions.
Here are some relevant discussions and ideas:
Beancount Mailing list: "Beancount budget plugin" Has some good ideas, like the following syntax:
2015-01-01 budget-open Y2015
2015-03-15 budget-extra Y2015 Expenses:Car 5000.00 EUR
2015-07-31 budget-balance Y2015 Expenses:Travel 0.00 EUR
2015-08-31 budget-balance Y2015 Expenses:Travel 2000.00 EUR
2015-12-31 budget-balance Y2015 Expenses:Food 4800.00 EUR
2015-12-31 budget-balance Y2015 Expenses:Car 9800.00 EUR
2015-12-31 budget-balance Y2015 Income:Salary -40000.00 EUR
2015-12-31 budget-close Y2015
and
2015-12-31 budget-balance Y2015 Expenses:Food 4800.00 EUR [1d]
2015-12-31 budget-balance Y2015 Income:Salary -40000.00 EUR [2w]
I don't see this.
On Thu, Feb 25, 2016 at 11:58 PM, Red S notifications@github.com wrote:
@blais https://github.com/blais - quick OT comment: not sure what you're doing, but the first line of your response paragraphs have the quote character in them, making slightly difficult to read. Seems like your other posts on github also have the same issue. Are you seeing this as well?
— Reply to this email directly or view it on GitHub https://github.com/aumayr/fava/issues/165#issuecomment-189115513.
I don't see this.
Okay, I'll email you a screenshot so I don't continue OT here.
I agree budgets would be an awesome feature
I made some progress with the prototype, and one key learning is that (2) "In the beancount-file, as metadata" works well, but there are two drawbacks:
There is no "open"-directive for the root-level-accounts, eg. 2016-01-01 open Expenses
. So with this method it is not possible to set metadata for the root-level-accounts, and therefore no budget info.
(@blais is there a way around this? As far as I see when I do create an open
entry for Expenses
, it will be stripped.)
So I came up with a new "syntax", looking like this:
2015-10-01 open Expenses:Books
budget-2015-10: "50.00 EUR"
budget-2015-11-01: "45.00 EUR"
budget-2015-W50: "60.00 EUR"
budget-2016: "30.00 EUR"
budget-2016-Q2: "20.00 EUR"
I think it looks nice, and it is integrated in the beancount-file, where I think it belongs to. And it would be accessible to beancount-plugins, so it could be better integrated into beancount.
On integrating this directly into beancount:
bean-report
, and integration with bean-query
. +beancount
On Fri, Feb 26, 2016 at 3:06 AM, aumayr notifications@github.com wrote:
I also had the feeling that this should be a feature of beancount rather than just fava.
Where I am pretty sure now is how it should work:
Set the budget for a specific period (day, week, month, quarter, year), and be able to change it with a new entry with a date after the previous entry, as in my example above.
I can't come up with a situation that this does not cover, from in-period budget changes to periods without a budget (setting it to None after a specific date, until the next budget entry comes along).
What I am still struggling with is how/where it should be implemented. That it should live in/near beancount is clear for me now, but exactly how is open. From your suggestions, and some new ideas of my own:
1.
In a separate file, like my example at the top. 2.
In the beancount-file, as metadata:
2009-05-05 open Expenses:Food:Groceries budget: "2015-01-01 monthly 150.00 USD" budget: "2016-01-01 daily 25.00 USD"
Pro: No change necessary to beancount itself. Accessable by plugins. Con: No real integration with beancount. Errors not along with beancount-errors. Hack-ish. 3.
In the beancount-file, as a new type of directive:
2015-01-01 budget Expenses:Food:Groceries weekly 150.00 USD
Pro: Official support, part of the language, "strongly typed", errors along existing errors. Con: Large change to beancount.
Eventually that's nicest IMO. For now, perhaps a bit too early. I'd start out with the one you have below and evolve that a bit before committing to creating a new entry.
(Note: Eventually I want to let plugins able to define their own directives like this. A plugin could declare a new directive type, and a lax parser would produce them and validate against a list of accepted tokens that comes with the new directive definition. This has only been an idea so far, but I think much of the existing directives I have could be converted to that. Anyway, it's a distant idea for now.)
1. 2.
In the beancount-file, as comments:
;budget Expenses:Food:Groceries weekly 150.00 USD
Pro: Quick prototype for beancount possible. Con: Ugly, hack-ish.
If this is to be included in a beancount-file, then the question of organizing is also relevant. I personally like having all budget-related infos next to the Account in one spot, like my example at the top and (1) and like the metadata-solution (2).
— Reply to this email directly or view it on GitHub https://github.com/aumayr/fava/issues/165#issuecomment-189155305.
+beancount
On Sun, Feb 28, 2016 at 3:16 AM, aumayr notifications@github.com wrote:
I made some progress with the prototype, and one key learning is that (2) "In the beancount-file, as metadata" works well, but there are two drawbacks:
-
The syntax suggested is not working, because metadata-keys have to be unique (duh, that was obvious).
There is no "open"-directive for the root-level-accounts, eg. 2016-01-01 open Expenses. So with this method it is not possible to set metadata for the root-level-accounts, and therefore no budget info.
(@blais https://github.com/blais is there a way around this? As far as I see when I do create an open entry for Expenses, it will be stripped.)
So I came up with a new "syntax", looking like this:
2015-10-01 open Expenses:Books budget-2015-10: "50.00 EUR" budget-2015-11-01: "45.00 EUR" budget-2015-W50: "60.00 EUR" budget-2016: "30.00 EUR" budget-2016-Q2: "20.00 EUR"
I think it looks nice, and it is integrated in the beancount-file, where I think it belongs to. And it would be accessible to beancount-plugins, so it could be better integrated into beancount.
"Dated" metadata like this looks a little abusive. What does that look like with years worth of data on that account? That would be a lot of meta-data... Personally I think this would be better achieved with a dedicated directive.
On integrating this directly into beancount:
- I try to interate quickly on how the "Interface" (way of storing budget data) should look like.
- When this is settled, moving this from fava/the 'budgeting'-branch to beancount should be the next step. Checking the input for errors can be done by a plugin, and the reporting-part has to be integrated into the beancount-code.
- In beancount, there are two things that would make sense IMHO: Integration with bean-report, and integration with bean-query.
— Reply to this email directly or view it on GitHub https://github.com/aumayr/fava/issues/165#issuecomment-189818450.
I just created you a "custom" custom directive to muck around with. This should parse, for example:
2015-10-01 open Expenses:Books 2016-10-01 custom "budget" 50.00 EUR 2016-11-01 custom "budget" 45.00 EUR 2016-11-10 custom "budget" 60.00 EUR 2016-12-31 custom "budget" 30.00 EUR
You can put a list of strings, dates, numbers, amounts, booleans after "budget". The parser creates beancount.core.data.Custom directives but does nothing else with them. It doesn't check that they're consistent. You can write a plugin that picks these up and does something with them. Later on I'll provide some sort of registration call one can add to have the parser check at least the data types for directives of a particular "type".
Finally, ideally, it would have been preferred to make this syntax just create an unknown or custom directive:
2016-11-01 budget ...
but it's a bit sensitive to add such an unknown id to the tokenizer at the moment, as it would interfere with some of the rest of the syntax, like key-values. I'd need more time and a lot of testing to put that in (though it's possible).
I hope this helps prototyping stuff.
More details here: https://bitbucket.org/blais/beancount/commits/50cbdfea0eeefccf63c1a1726e121086741f269a
On Sun, Feb 28, 2016 at 2:25 PM, Martin Blais blais@furius.ca wrote:
+beancount
On Sun, Feb 28, 2016 at 3:16 AM, aumayr notifications@github.com wrote:
I made some progress with the prototype, and one key learning is that (2) "In the beancount-file, as metadata" works well, but there are two drawbacks:
-
The syntax suggested is not working, because metadata-keys have to be unique (duh, that was obvious).
There is no "open"-directive for the root-level-accounts, eg. 2016-01-01 open Expenses. So with this method it is not possible to set metadata for the root-level-accounts, and therefore no budget info.
(@blais https://github.com/blais is there a way around this? As far as I see when I do create an open entry for Expenses, it will be stripped.)
So I came up with a new "syntax", looking like this:
2015-10-01 open Expenses:Books budget-2015-10: "50.00 EUR" budget-2015-11-01: "45.00 EUR" budget-2015-W50: "60.00 EUR" budget-2016: "30.00 EUR" budget-2016-Q2: "20.00 EUR"
I think it looks nice, and it is integrated in the beancount-file, where I think it belongs to. And it would be accessible to beancount-plugins, so it could be better integrated into beancount.
"Dated" metadata like this looks a little abusive. What does that look like with years worth of data on that account? That would be a lot of meta-data... Personally I think this would be better achieved with a dedicated directive.
On integrating this directly into beancount:
- I try to interate quickly on how the "Interface" (way of storing budget data) should look like.
- When this is settled, moving this from fava/the 'budgeting'-branch to beancount should be the next step. Checking the input for errors can be done by a plugin, and the reporting-part has to be integrated into the beancount-code.
- In beancount, there are two things that would make sense IMHO: Integration with bean-report, and integration with bean-query.
— Reply to this email directly or view it on GitHub https://github.com/aumayr/fava/issues/165#issuecomment-189818450.
@blais This is awesome! Thank you!
I will change the prototype to use these "custom" directives, and will report back how it went.
It looks like the current syntax doesn't support things like this:
A transaction from my Amex credit card to BestBuy in budget category "Entertainment" and the things I brought is a Fallout 4
This contains 4 piece of informations:
I was wondering if this can fit in your implementation? Thanks.
@yegle It does (standard Beancount syntax):
2016-03-15 * "BestBuy" "Fallout 4"
Expenses:Entertainment 50.00 USD
Liabilities:Amex:CreditCard
@aumayr You are right, I wasn't aware of the "payee" field in transaction directive.
OK so the code starts to look very nice (as does the UI), and so the discussion is to be held over if/how we should integrate this into master
.
This feature could be "transparent" as long as you don't use the custom directives in your beancount file, meaning no visual change for current users, but it starts to show up if you do.
What do you think, @yagebu ? (Will push the code over the weekend)
What do you think, @yagebu ? (Will push the code over the weekend)
Can you create a PR when you're done? Then I'll review the code and merge.
@aumayr any help needed on this one?
@cgrinds Sorry for the long wait, but I still did not get around to get this working properly. So help is very much appreciated!
What I have:
The new custom directives do not really look good to me, because you would have to specify the account for which this budget would be valid as a string, which looks ugly:
2016-04-08 custom "balance" "Expenses:Computer" "2016-01" 50.00 USD
What is missing:
I took a look at what you have so far and IMO you're close enough to merge into main and get more folks kicking the tires.
There are certainly many experiments on how to show over/under budget, red/green/yellow bars, something like this, but those are iterations on the core of what you have now. And those experiments are less likely to happen until you merge.
Expense | Budgets | Spent | Available |
---|---|---|---|
Groceries | 200.00 USD | 150.00 USD | 50.00 USD |
Coffee | 12.00 USD | 20.00 USD | -8.00 USD |
Mortgage | 1000.00 USD | 1000.00 USD | 0.00 USD |
The new custom directives do not really look good to me, because you would have to specify the account for which this budget would be valid as a string, which looks ugly:
Agreed - encoding values in strings diminishes one of beancount's strongest features, which is, "help me not screw up my data." Maybe it makes sense for the initial merge to only support the external file until you get more feedback and nail down a better integrated format?
Integrating this into the API in a way that does not impact performance too much
I don't think it will be a big impact, and if it is there's plenty of low-hanging fruit like replacing some of the lists with dicts, dateline merging, etc.
My guess is most folks will use a monthly budget - which means one budget line per expense (and in some cases, only a subset of expenses). The way you've coded it provides tons more flexibility, but Moneydance, YNAB, mvelopes, etc all use monthly budgeting. Although, I suppose if you want to do a carry-the-excess-over to the next month like YNAB, you would end up with one budget line per month per expense, but I still doubt that will result in much of a performance hit. But hey, that's why we have profilers :)
I don't think you should let performance concerns dissuade you.
FWIW - I took a look at a few scenarios in my environment. My beancount file has data back to 1995.
Type | # Entries |
---|---|
Transaction | 21,855 |
Open | 155 |
Event | 14 |
Query | 1 |
Total | 22,025 |
I created a budget file with a month line for Groceries like so:
1995-01 220.00 USD
When I surf to account/Expenses/monthly_changes/
5.5 MB is transferred over 4 requests, DomContentLoaded: 9.13s
The table loads in 3.1s, rendering the charts takes the other 6s.
(2013 MBP)
I added three more expenses with a similar Jan 1995 month line, the table load increased to 3.7s.
On master when I surf to account/Expenses/changes/?interval=month
8.8 MB is transferred over 4 requests, DomContentLoaded: 9.16s
The table loads in 7.8s, rendering the charts takes the remainder.
I took a look at what you have so far and IMO you're close enough to merge into main and get more folks kicking the tires.
@cgrinds I pushed a new branch and created this PR to discuss code/optimizations: #257
On Fri, Apr 8, 2016 at 11:35 PM, Chris Grindstaff notifications@github.com wrote:
The new custom directives do not really look good to me, because you would have to specify the account for which this budget would be valid as a string, which looks ugly:
Agreed - encoding values in strings diminishes one of beancount's strongest features, which is, "help me not screw up my data." Maybe it makes sense for the initial merge to only support the external file until you get more feedback and nail down a better integrated format?
The only reason I haven't included account names in the sets of directives is that they don't parse into their own datatype... they parse into 'str' objects. Therefore, there's no practical way to round-trip them.
Short of creating a new custom datatype for Account names - and BTW I've thought about it, and it would be a fair bit of work to ensure that the types are trickled down through the variious transformations on account names - one thing I could do is to make the "values" atttribute a list of pairs of (value, datatype).
Thanks @blais for implementing Account names in custom directives!
Now it looks very clean to use the custom directives to implement the budget-entries, so I will implement this.
For reference: https://bitbucket.org/blais/beancount/commits/7741ed8fa3e5
Thanks @blais and @aumayr - that does look nicer!
I implemented the parsing from the custom
directives in 7403382
They look like this:
2015-04-09 custom "budget" Expenses:Books "W" 20.00 EUR
"D"
for daily"W"
for weekly"M"
for monthly"Q"
for quarterly"Y"
for yearlyThe budget entries also have a different background color in the Journal.
What would be nice:
I think of changing/aliasing the period modifiers to:
"D"
or "daily"
or "day"
"W"
or "weekly"
or "week"
"M"
or "monthly"
or "month"
"Q"
or "quarterly"
or "quarter"
"Y"
or "yearly"
or "year"
@aumayr you mean supporting all 3 versions?
If so, sounds reasonable to me. I usually prefer one way to express a concept because it simplifies reading, but that's not really an issue with budgets or beancount, and in this case, the options are similar enough that it doesn't matter.
@cgrinds Yes I do mean supporting all three.
I think there should be only one possible choice for each of the periods (and I'm for one of the long names for clarity, but don't really have a strong preference as I'm not likely to use budgeting). This seems to be most consistent with the style of the beancount syntax, where there's one canonical name for each directive and option only (with the exception of the aliasing between txn
and *
, which exists for another kind of consistency only). Having multiple aliases will increase documentation for the feature and while the code required for it is quite trivial, this might still lead to bugs in the future, because one of us didn't consider that there are these different aliases.
I don't see any benefit in adding multiple aliases on the other hand. It's not like this is a legacy feature where we have to support some old syntax. It's new, so why not make it as concise as possible.
@yagebu You are right. I would settle for the -ly
-versions.
This got merged into master
, so @cgrinds @redstreet @corani you can test this :-)
Will close this issue, and if you find any bugs please reopen, and for new budgeting-related features/views/charts, etc. please open a new issue.
Thanks! I'll give it a try.
I've found one issue with the number formatting, the number of decimals is somewhat... excessive:
@corani This is very strange. Can you produce a small test-file so I can reproduce this?
"excessive" 🙈
I'm suspecting the dcontext, which for me is:
CNY : sign=0 integer_max=1 fractional_common=_ fractional_max=_ "0.*" "0.*"
I have no idea what is causing this though. In my minimal test file, the dcontext is correct:
CNY : sign=0 integer_max=3 fractional_common=2 fractional_max=6 "000.00" "000.000000"
Do you have any idea what could be messing up my dcontext? Or, alternatively, know of a way to manually configure the parameters?
Never mind, I figured it out. I suspect a bug in beancount (attn: @blais)
All my transactions are in include
files. Apparently beancount doesn't pick up the correct dcontext parameters in that case. After I added a transaction to the master file, the dcontext was correct.
Ah yes. That's an interesting question, how to deal with that elegantly.
On Fri, May 27, 2016 at 3:34 AM, Daniel Bos notifications@github.com wrote:
Never mind, I figured it out. I suspect a bug in beancount (attn: @blais https://github.com/blais)
All my transactions are in include files. Apparently beancount doesn't pick up the correct dcontext parameters in that case. After I added a transaction to the master file, the dcontext was correct.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aumayr/fava/issues/165#issuecomment-222080216, or mute the thread https://github.com/notifications/unsubscribe/AAUgk8TRcvbJ7to1fnIEmpQty8L18q3Fks5qFp6fgaJpZM4HjI__ .
Aknowledged. I think I know how to fix this. Here's the tracking ticket: https://bitbucket.org/blais/beancount/issues/131/aggregate-the-state-of-displaycontext
On Sat, May 28, 2016 at 6:29 PM, Martin Blais blais@furius.ca wrote:
Ah yes. That's an interesting question, how to deal with that elegantly.
On Fri, May 27, 2016 at 3:34 AM, Daniel Bos notifications@github.com wrote:
Never mind, I figured it out. I suspect a bug in beancount (attn: @blais https://github.com/blais)
All my transactions are in include files. Apparently beancount doesn't pick up the correct dcontext parameters in that case. After I added a transaction to the master file, the dcontext was correct.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aumayr/fava/issues/165#issuecomment-222080216, or mute the thread https://github.com/notifications/unsubscribe/AAUgk8TRcvbJ7to1fnIEmpQty8L18q3Fks5qFp6fgaJpZM4HjI__ .
Beancount itself is a double-book accounting tool, and does not know of the concept of "budgets".
But the more I use fava I wish there would be a way to display information if a certain account is over budget. I do practice setting budgets for various "accounts" myself to enforce certain spending behavior, and it would be nice to integrate this into the system.
In the "budgeting"-branch I drafted a first version of how this might work and look:
There is a new file which contains the budget-rules. It is a simple plain-text-file and has content like this:
The format is very simple: First, the account name (
Expenses:Food:Groceries
). Then, lines with the week of the year where this budget applies to (and starts) (2016-W01
), and finally the amount and currency (20.00 USD
). I will call these lines "Budget entries".10.00 USD
at the very first week of 2015 (2015-W01
), and this budget applies to all weeks until a new entry starting in week 5 of that same year (2015-W05
) appears and sets the new budget to20.00 USD
.I included a test-file in
fava/util/test-budget.budget
, which contains the rules above for Groceries and Alcohol (accounts in the file generated bybean-example
).You can test it by starting fava with a
bean-example
-generated file, and navigating to http://localhost:5000/account/Expenses:Food/monthly_changes/ (for example). It should look like this:Things to do:
account.html
-template, but should ultimately be either part of the API or in a second API (BudgetAPI
?).What do you think @yagebu @corani @redstreet @jbms @xentac @blais