Giter VIP home page Giter VIP logo

beancount's Introduction

beancount: Double-Entry Accounting from Text Files

A double-entry bookkeeping computer language that lets you define financial transaction records in a text file, read them in memory, generate a variety of reports from them, and provides a web interface.

Documentation can be read at:

https://beancount.github.io/docs/

Documentation authoring happens on Google Docs, where you can contribute by requesting access or commenting on individual documents. An index of all source documents is available here:

http://furius.ca/beancount/doc/index

There's a mailing-list dedicated to Beancount, please post questions there, so others can share in the responses. More general discussions about command-line accounting also occur on the Ledger mailing-list so you might be interested in that group as well.

You can obtain the source code from the official Git repository on Github:

See the Installing Beancount document for more details.

There are three versions

  • Version 3 (branch master): The in-development next version of Beancount since June 2020. This is unstable and you want to use version 2 below. The scope of changes is described in this document.
  • Version 2 (branch v2): The current stable version of Beancount, in maintenance mode as of July 2020. This was a complete rewrite of the first version, which introduced a number of constraints and a new grammar and much more. Use this now.
  • Version 1 (branch v1): The original version of Beancount. Development on this version halted in 2013. This initial version was intended to be similar to and partially compatible with Ledger. Do not use this.

Tickets can be filed at on the Github project page:

https://github.com/beancount/beancount/issues

Copyright (C) 2007-2022 Martin Blais. All Rights Reserved.

This code is distributed under the terms of the "GNU GPLv2 only". See COPYING file for details.

Beancount has found itself being useful to many users, companies, and foundations since I started it around 2007. I never ask for money, as my intent with this project is to build something that is useful to me first, as well as for others, in the simplest, most durable manner, and I believe in the genuinely free and open stance of Open Source software. Though its ends are utilitarian - it is about doing my own accounting in the first order - it is also a labor of love and I take great pride in it, pride which has pushed me to add the polish so that it would be usable and understandable by others. This is one of the rare areas of my software practice where I can let my desire for perfection and minimalism run untamed from the demands of time and external constraints.

Many people have asked where they can donate for the project. If you would like to give back, you can send a donation via Wise (preferably):

https://wise.com/share/martinb4019

or PayPal at:

https://www.paypal.com/paypalme/misislavski

Your donation is always appreciated in any amount, and while the countless hours spent on building this project are impossible to match, the impact of each donation is much larger than its financial import. I truly appreciate every person who offers one; software can be a lonely endeavour, and those donations as well as words of appreciation keep reminding me of the positive impact my side projects can have on others. I feel gratitude for all users of Beancount.

Thank you!

Martin Blais <[email protected]>

beancount's People

Contributors

aaronj1335 avatar ambroisie avatar aumayr avatar blais avatar ccaron avatar dnicolodi avatar edejong avatar einarsi avatar glasserc avatar hwright avatar jamessan avatar jmoles avatar johannesjh avatar kenkangxgwe avatar llpamies avatar medranocalvo avatar mhansen avatar monnier avatar omasanori avatar pmarciniak avatar rajk04 avatar redstreet avatar rkhwaja avatar simonmichael avatar tbm avatar trim21 avatar w1ndy avatar xuhcc avatar yagebu avatar zacchiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beancount's Issues

TypeError: balance() missing 1 required positional argument: 'kvlist'

Original report by Aaron Bull Schaefer (Bitbucket: elasticdog, GitHub: elasticdog).


I'm seeing the above error when trying to run any of the bean-* applications running the latest from Mercurial...

$ bean-example > example.bean
INFO    : Generating Salary Employment Income
INFO    : Generating Expenses from Banking Accounts
INFO    : Generating Regular Expenses via Credit Card
INFO    : Generating Credit Card Expenses for Trips
INFO    : Generating Credit Card Payment Entries
INFO    : Generating Tax Filings and Payments
TypeError: balance() missing 1 required positional argument: 'kvlist'
fish: Job 1, 'bean-example > new-example.bean' terminated by signal SIGABRT (Abort)
$ bean-web ledger.bean 
Bottle v0.12.8 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

INFO    : Reloading...
TypeError: balance() missing 1 required positional argument: 'kvlist'
fish: Job 1, 'bean-web ledger.bean ' terminated by signal SIGABRT (Abort)                                     
$ bean-check --verbose ledger.bean
TypeError: balance() missing 1 required positional argument: 'kvlist'
fish: Job 1, 'bean-check --verbose ledger.bean' terminated by signal SIGABRT (Abort)

...here's the revision I'm running:

$ hg summary
parent: 2592:02e59de6f3c8 tip
 (merge)
branch: default
commit: (clean)
update: (current)

$ python3 --version
Python 3.4.3

Please let me know if you need any further info or have suggestions on how to get better output for you.

Bug in treeify column identification

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


I encounter this:

bean-report ex.bc bal | treeify
WARNING: Could not find any valid column in input
Assets:Bank:DE:Bankname:Tagesgeld 3.57 EUR
Equity:Opening-Balances -3.57 EUR
Expenses
Income
Liabilities

Is this intended?

"bean-doctor context" broke in revision ba5032375ba8

Original report by Matthew Harris (Bitbucket: matthew_harris, GitHub: mharris312).


#!bash

$ cat test.beancount
2000-01-01 open Assets:Checking

$ hg update -r dfb88ced396e
$ ./setup.py install

$ bean-doctor context test.beancount 1
Hash:9ec07ee70bcbade115c2d47e57e8d301
Location: test.beancount:1


2000-01-01 open Assets:Checking                                 

$ hg update -r ba5032375ba8
$ ./setup.py install
$ bean-doctor context test.beancount 1
No entry could be found before test.beancount:1

PEP8 issues

Original report by Austin Bingham (Bitbucket: austin_bingham, GitHub: abingham).


Are you interested in patches that fix PEP8 issues? My editor highlights them, so it's relatively simple for me to fix them as I'm poking through the code. But I don't want to pester you with patches if you're not interested in merging them in.

Figure out how to disable tolerance inference on numbers output from arithmetic expressions

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


I'm not sure I understand how the divide operator interacts with the recent tolerance changes, if it does. For example, if I do this:


option "title" "Main accounts"
option "operating_currency" "USD"

1999-01-01 open Liabilities:Credit-Card
1999-01-01 open Expenses:Utility-Bill

2000-01-01 * "Power company"
Liabilities:Credit-Card -331 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD
Expenses:Utility-Bill 331/12 USD

I get: bean-check output:
divide.bc:7: Transaction does not balance: (-2.8E-25 USD)

Is there a recommended way to handle such situations without having to add an explicit rounding error posting?

NameError: name 'prices' is not defined

Original report by clemente (Bitbucket: clemente, GitHub: clemente).


beancount> select price,convert(price,'EUR')
Traceback (most recent call last):
  File "/usr/lib/python3.4/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'BQLShell' object has no attribute 'do_select'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/w/beancount/src/python/beancount/query/shell.py", line 225, in default
    self.dispatch(statement)
  File "/w/beancount/src/python/beancount/query/shell.py", line 215, in dispatch
    return method(statement)
  File "/w/beancount/src/python/beancount/query/shell.py", line 358, in on_Select
    self.options_map)
  File "/w/beancount/src/python/beancount/query/query_execute.py", line 220, in execute_query
    values = [c_expr(context) for c_expr in c_target_exprs]
  File "/w/beancount/src/python/beancount/query/query_execute.py", line 220, in <listcomp>
    values = [c_expr(context) for c_expr in c_target_exprs]
  File "/w/beancount/src/python/beancount/query/query_env.py", line 229, in __call__
    return prices.convert_amount(context.price_map, args[1], args[0])
NameError: name 'prices' is not defined

KeyError: 'USD' running returns.py due to date calculation

Original report by Aaron Bull Schaefer (Bitbucket: elasticdog, GitHub: elasticdog).


Due to the dates listed for some of my accounts, the returns.py script tried to generate returns for periods where there were no transactions. This caused the error when trying to print:

Returns for Aaron's Fidelity 401k account
  Period            Begin      -> End       :        Total   Annualized
Traceback (most recent call last):
  File "./returns.py", line 90, in <module>
    main()
  File "./returns.py", line 86, in main
    total_returns['USD'] - 1, annual_returns['USD'] - 1))
KeyError: 'USD'

...I'm not very familiar with Python dev, but to work around that locally I just added a test for the key before printing:

if 'USD' in total_returns:
    print(FORMAT.format(period_name, str(date_begin), str(date_end),
                        total_returns['USD'] - 1, annual_returns['USD'] - 1))

I'm sure there's probably a cleaner solution, but I wanted to make you aware that I hit this issue.

bean-query barfs when comparing a position with a number

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


So I tried this

select date, narration, position balance from year=2013 where account ~ "Liabilities.*PropertyTax$" and (position > 0.00),

Try with "number".
The "position" column returns an object of type Position.

I've cooked a script in attachment for you.

but it gives me

Traceback (most recent call last):
File "/usr/lib/python3.4/cmd.py", line 214, in onecmd
func = getattr(self, 'do_' + cmd)
AttributeError: 'BQLShell' object has no attribute 'do_select'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "usr/local/lib/python3.4/site-packages/beancount/query/shell.py", line 223, in default
self.dispatch(statement)
File "/usr/local/lib/python3.4/site-packages/beancount/query/shell.py", line 213, in dispatch
return method(statement)
File "/usr/local/lib/python3.4/site-packages/beancount/query/shell.py", line 343, in on_Select
self.options_map)
File "/usr/local/lib/python3.4/site-packages/beancount/query/query_execute.py", line 207, in execute_query
if c_where is None or c_where(context):
File "/usr/local/lib/python3.4/site-packages/beancount/query/query_compile.py", line 111, in call
return self.operator(self.left(context), self.right(context))
File "/usr/local/lib/python3.4/site-packages/beancount/query/query_compile.py", line 111, in call
return self.operator(self.left(context), self.right(context))
TypeError: unorderable types: Position() > decimal.Decimal()

Uh-oh. That's clearly a bug.

bean-check fails on a transaction with no values

Original report by Matthew Harris (Bitbucket: matthew_harris, GitHub: mharris312).


Sample inputs:

2000-01-01 * "Test"
Assets:Foo

2000-01-01 * "Test"
Assets:Foo
Assets:Bar

For either of these sample inputs, bean-check gives the following stack trace:

$ bean-check test.beancount
Traceback (most recent call last):
File "/Users/mharris/homebrew/bin/bean-check", line 2, in
from beancount.scripts.check import main; main()
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/scripts/check.py", line 39, in main
extra_validations=validation.HARDCORE_VALIDATIONS)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/loader.py", line 52, in load_file
return _load(parser.parse_file, filename, log_timings, log_errors, extra_validations)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/loader.py", line 125, in _load
printer.print_errors(errors, file=log_errors)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/parser/printer.py", line 324, in print_errors
output.write(format_error(error))
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/parser/printer.py", line 294, in format_error
error_string = '\n'.join(format_entry(entry) for entry in entries)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/parser/printer.py", line 294, in
error_string = '\n'.join(format_entry(entry) for entry in entries)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/parser/printer.py", line 224, in format_entry
return EntryPrinter(dcontext, render_weights)(entry)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/parser/printer.py", line 105, in call
method(obj, oss)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/parser/printer.py", line 131, in Transaction
width_account = max(len(flag_account) for flag_account in strs_account)
ValueError: max() arg is an empty sequence

Implement --open/--close dates for balsheet/income reports

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


I want to have a plugin that generates forecasted transactions, but rather than forecasting for an arbitrary date range or specific number or transaction I want to only generate transactions within the scope of the query. For example, if I'm looking at the registers or balances for 2014, from your example, then forecasted transactions should be generated up to 2015-01-01. If I'm just looking at current balances (no date is specified) then no forecasted transactions need to be generated. Similarly, no generated transactions would be needed when viewing 2013 data, but a whole years worth would be necessary for viewing 2015 projections.

  • Harpreet "Eli" Sangha

thread: "Specify Date Range"

Exporting with total cost somehow leads to a negative value for total.

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


That's caused by a bug. Invoking exportpf with --debug will show the corrrect holding and cost. I also see in the export that the total cost is a negative value. I'll log a ticket.

Matthew Harris
Buy
Is it correct that even negative transactions (sales, fees, rebalances) show as "Buy" and the date is last Friday for all transactions?
Martin Blais
Martin Blais
There should be no negative holdings. I haven't dealt with short positions yet if that's what you're referring to. If you don't have any shorts, all units should be positive.

Fees are just cash, shouldn't appear anywhere.

I don't know what you mean precisely with "rebalances" you'll have to give me a bit more color.

All transactions should appear
The date will be the previous date for all transactions (see the comment about this under Purchase Dates near the end of this doc).
Matthew Harris
Matthew Harris
I'm not talking about shorts. Fees are not just cash; for most of my accounts, fees are subtracted by taking proportionate shares of each fund. By "rebalances", I mean transactions that sell one fund and buy another.

Here's an example Beancount file that produces a negative price in GF:

2000-01-01 open Assets:VDMPX
2000-01-01 open Assets:VDIPX
2000-01-01 open Equity:OpeningBalances

2014-01-01 *
Assets:VDMPX 168.23656 VDMPX {{1000.00 USD}}
Equity:OpeningBalances
2014-04-04 * "Fund Change"

  • Assets:VDMPX -168.23656 VDMPX {{1000.00 USD}} @ 118.81 USD
  • Assets:VDIPX 960.50889 VDIPX {{1000.00 USD}} @ 20.81 USD

It appears as 960.50889 VDIPX at -1.330761314871992562203217858.

In the web interface, clicking on a directive that has no context generates an error

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


  • BUG: In web interface... clicking on a directive that cannot be contexted
    right generates an error like this:

    127.0.0.1 - - [25/Jan/2015 00:41:33] "GET
    /context/7a79f22d284d032e2b28501e904e4826 HTTP/1.1" 500 59
    Traceback (most recent call last):
    File "/usr/local/lib/python3.4/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
    File "/usr/local/lib/python3.4/site-packages/bottle.py", line 979, in call
    return self.wsgi(environ, start_response)
    File "/usr/local/lib/python3.4/site-packages/bottle.py", line 954, in wsgi
    out = self._cast(self._handle(environ))
    File "/usr/local/lib/python3.4/site-packages/bottle.py", line 862, in handle
    return route.call(**args)
    File "/usr/local/lib/python3.4/site-packages/bottle.py", line 1729, in wrapper
    rv = callback(*a, **ka)
    File "/home/blais/p/beancount/src/python/beancount/web/web.py", line 939, in
    wrapper
    return callback(*posargs, **kwargs)
    File "/home/blais/p/beancount/src/python/beancount/web/web.py", line 381, in
    context

    app.entries, dcontext, entry.meta.filename, entry.meta.lineno))
    File "/home/blais/p/beancount/src/python/beancount/reports/context.py", line
    33, in render_entry_context
    raise SystemExit("No entry could be found before {}:{}".format(filename,
    lineno))

Exception in leafonly plugin if non-leaf account has no Open directive

Original report by Nathan Grigg (Bitbucket: nathangrigg, GitHub: nathangrigg).


If you have a non-leaf posting on an account that doesn't exist, the leafonly plugin raises an AttributeError if there is no Open directive. The problem is that 'open_entry' is None.

https://bitbucket.org/blais/beancount/src/317b0a91b8d584380b0b750ae438f8af334ef911/src/python/beancount/plugins/leafonly.py?at=default#cl-41

#!python

Traceback (most recent call last):
  File "/usr/local/python3/bin/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/python3/bin/bottle.py", line 1729, in wrapper
    rv = callback(*a, **ka)
  File "/usr/local/python3/lib/python3.4/site-packages/beancount/web/web.py", line 912, in wrapper
    entries, errors, options_map = loader.load_file(filename)
  File "/usr/local/python3/lib/python3.4/site-packages/beancount/loader.py", line 52, in load_file
    return _load(parser.parse_file, filename, log_timings, log_errors, extra_validations)
  File "/usr/local/python3/lib/python3.4/site-packages/beancount/loader.py", line 111, in _load
    entries, errors = run_transformations(entries, parse_errors, options_map, log_timings)
  File "/usr/local/python3/lib/python3.4/site-packages/beancount/loader.py", line 182, in run_transformations
    entries, plugin_errors = callback(entries, options_map)
  File "/usr/local/python3/lib/python3.4/site-packages/beancount/plugins/leafonly.py", line 43, in validate_leaf_only
    open_entry.meta,
AttributeError: 'NoneType' object has no attribute 'meta'

Add support for querying metadata in bean-query

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


This has been on the list for a while, but I'm afraid it'll open a can of worms once I start coding.

bw3443 writesL

How can I query for meta information 'doc'?
I can't find 'meta' in Beancount - Query Language documentation.
bean-query file.beancount attributes does not list the attribute.
Neither bean-query file.beancount targets . (shouldn't both list all available meta columns automatically?)

#!python

from beancount import loader
 
entries, errors, options = loader.load_string(
"""2015-03-24 * "FastMail Pty Ltd" "Annual E-Mail Enhanced Subscription"
  doc: "D1"
  Expenses:Office                                   40.00 USD @ 0.9545 EUR
  Assets:Bank:DE:Comdirekt:Giro                     -38.18 EUR
""")
 
print(entries[0].meta['doc'])

https://bitbucket.org/blais/beancount/src/0c38bd8110a7ddb36ce8d6003c244e7d931ca028/src/python/beancount/query/query_env.py?at=default#cl-896

#!python

… 'price' : PriceColumn,  'weight' : WeightColumn,  'balance' : BalanceColumn,  }

should be extended by any metaColumn:value, so

#!python

… 'price' : PriceColumn, 'weight' : WeightColumn, 'balance' : BalanceColumn, 'metaColumn': MetaColumn }

How can this be automatically done for any meta field I introduce with file.beancount?

Consequently, I do

#!python

  bean-query file.beancount 'select date, narration, account, number, receipt'

which includes a column with the values I specified for 'receipt'.

Best wishes,

'Transaction' object has no attribute 'source' ← when requesting BQL field "filename"

Original report by clemente (Bitbucket: clemente, GitHub: clemente).


: dc; /w/beancount ; /w/beancount ; PYTHONPATH=/w/beancount/src/python /w/beancount/bin/bean-query ~/my.beancount 
Input file: "Beancount"
Ready with 3 directives (2 postings in 1 transactions).
beancount> select account,filename;
Traceback (most recent call last):
  File "/usr/lib/python3.4/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'BQLShell' object has no attribute 'do_select'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/w/beancount/src/python/beancount/query/shell.py", line 225, in default
    self.dispatch(statement)
  File "/w/beancount/src/python/beancount/query/shell.py", line 215, in dispatch
    return method(statement)
  File "/w/beancount/src/python/beancount/query/shell.py", line 358, in on_Select
    self.options_map)
  File "/w/beancount/src/python/beancount/query/query_execute.py", line 215, in execute_query
    values = [c_expr(context) for c_expr in c_target_exprs]
  File "/w/beancount/src/python/beancount/query/query_execute.py", line 215, in <listcomp>
    values = [c_expr(context) for c_expr in c_target_exprs]
  File "/w/beancount/src/python/beancount/query/query_env.py", line 655, in __call__
    return context.posting.entry.source.filename
AttributeError: 'Transaction' object has no attribute 'source'
beancount> exit

The file is just:

1970-01-01 open Expenses:Something
1970-01-01 open Assets:Account

1999-02-13 * "test"
  Expenses:Something		52200 PTA
  Assets:Account -52200 PTA

'ParserSyntaxError' object has no attribute 'meta'

Original report by Matthew Harris (Bitbucket: matthew_harris, GitHub: mharris312).


If I run bean-web on a trivial erroneous input file (e.g. a file containing just the text "hello world") and visit the errors page (http://localhost:8080/errors), I get the following error on the console:

Bottle v0.12.7 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

INFO : Reloading...
,----------------------------------------------------------------
test.beancount:1: syntax error, unexpected ERROR

test.beancount:1: Lexer error; erroneous token: 'hello'

test.beancount:1: Lexer error; erroneous token: 'world'

`----------------------------------------------------------------
Traceback (most recent call last):
File "/Users/mharris/homebrew/bin/bottle.py", line 862, in handle
return route.call(**args)
File "/Users/mharris/homebrew/bin/bottle.py", line 1729, in wrapper
rv = callback(*a, **ka)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/web/web.py", line 939, in wrapper
return callback(*posargs, **kwargs)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/web/web.py", line 317, in errors
contents=render_report(misc_reports.ErrorReport, [], leaf_only=False))
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/web/web.py", line 154, in render_report
report
.render_htmldiv(entries, app.errors, app.options, oss)
File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/reports/misc_reports.py", line 50, in render_htmldiv
printer.render_source(error.meta)))
AttributeError: 'ParserSyntaxError' object has no attribute 'meta'
127.0.0.1 - - [03/Jan/2015 01:27:03] "GET /errors HTTP/1.1" 500 747

Extend the cost-inferred tolerance further

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


About
option "experiment_infer_tolerance_from_cost" "TRUE"

It works just as I expected it to. Here's one case it fails:

2006-01-17 * "Plan Contribution"

  • Assets:Investments:VWELX 18.572 VWELX {30.96 USD}
  • Assets:Investments:Cash -575.00 USD

Given $575.00 and shares worth $30.96, we can get 18.572 shares with a bit left over.

I didn't see how this is implemented, but I propose that the tolerance band in this case should not be 575.00 +/- t but rather 575.00 - 2t, since they're never going to round up the number of shares they're going to give me for my cash.

Add --public option to bean-web to bind to external connections.

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


Yes, that's a well known networking setup issue. In fact. By default the web server doesn't accept connections from outside because all computers are networked these days... you don't want other boxes accessing your ledger contents by default I think. You're right that it should be possible to enable it though.

I'll (1) document this as you suggest, and (2) add a --public option or something like it to make it possible to turn it on from the command-line.

Thanks again for reporting this,

On Wed, Jan 21, 2015 at 6:56 PM, [email protected] wrote:
Figured it out:

app.run(host= 'localhost'...
to
app.run(host= '0.0.0.0'

in src/python/beancount/web/web.py

Would be good for this to go in the docs (Install document? FAQ?)

Refs:
http://stackoverflow.com/questions/7023052/flask-configure-dev-server-to-be-visible-across-the-network

Render subtotals in balances/balsheet/income reports

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


"In bean-web/balsheet, would it be possible/useful to include sub-totals for nested accounts? Possibly in light gray, to set them apart?"

Ledger users have gotten used to this... it's probably worth adding it as an option.

"You're the second person to request this (see previous email on the list).
I've always found that very confusing about Ledger's rendering of account trees; I think it's unreadable.

I'd prefer to render it in a separate column by default, because eventually when that report is output to an XLS or CSV file (I want to support all output formats for all reports), I want it to be possible to sum over that column. Or maybe make it optional. Alternatively, in bean-web, what I'd like to do is show the parent account subtotal when you collapse a node.
"

Balances output sometimes outputs -0.00

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


No, I've actually been doing all of my debugging with bean-check and bean-web so far. I haven't really gotten into the query language yet. I figure I'll do that when my balance sheet on bean-web more closely matches reality.

I didn't expect it to be a bug, but I'll take your word. :-) In bean-web, I was used to seeing blank spaces when accounts are closed and empty, but here I was seeing 0.00 and -0.00.

On Thu Jan 22 2015 at 7:35:55 PM Martin Blais [email protected] wrote:
That's right, it's a bug with precision indeed.

I presume you were generating your balances report like this:

bean-report /home/blais/u/Downloads/test.beancount balances
Equity:SourceOrSink 0.00 USD
Expenses
Income
Liabilities

You may also do this, which makes it more obvious what's going on:

bean-query /home/blais/u/Downloads/test.beancount "balances"
account sum_position


Assets:Investments:IRA 50.661 ABCDE {19.81 USD}
0.176 ABCDE {20.04 USD}
0.194 ABCDE {18.27 USD}
-0.583 ABCDE {17.16 USD}
1.055 ABCDE {17.75 USD}
0.172 ABCDE {17.92 USD}
52.632 ABCDE {19.00 USD}
-33.495 ABCDE {17.43 USD}
0.209 ABCDE {16.90 USD}
0.250 ABCDE {14.15 USD}
-0.693 ABCDE {14.44 USD}
0.248 ABCDE {14.34 USD}
0.269 ABCDE {13.13 USD}
0.224 ABCDE {15.88 USD}
0.223 ABCDE {16.00 USD}
-0.158 ABCDE {16.78 USD}
0.192 ABCDE {18.54 USD}
0.196 ABCDE {18.17 USD}
0.197 ABCDE {18.18 USD}
-0.524 ABCDE {19.10 USD}
0.299 ABCDE {18.99 USD}
0.260 ABCDE {19.28 USD}
0.253 ABCDE {19.90 USD}
-0.292 ABCDE {20.31 USD}
1.731 ABCDE {19.79 USD}
0.201 ABCDE {20.12 USD}
0.203 ABCDE {19.97 USD}
-74.100 ABCDE {20.24 USD}
Equity:SourceOrSink 2.00000000000E-13 USD

So it's a bug. I'll fix it.

On Thu, Jan 22, 2015 at 1:42 AM, Matthew S. Harris [email protected] wrote:
Attached is an example file that demonstrates what I meant by accounts showing balances of -0.00 in bean-web.

Total balance check is easy to implement and is desired

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


No, this achieves expressing multiple currencies in a single balance statement, but does not achieve verification that only these currencies are present.

  • Harpreet "Eli" Sangha

On Tue, Jan 6, 2015 at 7:58 PM, Martin Blais [email protected] wrote:
Does this also verify that there aren't any other gremlins lying in that account?
I think that was the desire for the "complete" balance check.

On Tue, Jan 6, 2015 at 10:13 PM, ELI [email protected] wrote:
I did this:

2015/01/01 Balance
Assets::Stock 0 = 3 AAPL
Assets::Stock 0 = 5 GOOGL
Assets::Stock 0 = 3 MSFT
Assets::Cash 0 = 50.00 USD
Assets::Cash 0 = 25.00 CHF
Assets::Cash 0 = 15.00 EUR

  • Harpreet "Eli" Sangha

On Tue, Jan 6, 2015 at 3:13 PM, John West [email protected] wrote:
I go about it like this:

2015/01/01 Balance
Assets::Stock = 3 AAPL
2015/01/01 Balance
Assets::Stock = 5 GOOGL
2015/01/01 Balance
Assets::Stock = 3 MSFT

And so on for Assets::Cash.

It works for me, without complaints from Ledger. I might be running my reports with different options, though.

On Tue, Jan 6, 2015 at 6:00 PM, Pascal Fleury [email protected] wrote:
Hello,

I love the multiple currency/commodity that one can have in the accounts. It let's me manage e.g. cash in USD, CHF and EUR, or my stock portfolio with different stock tickers.

When reconciling, though, I face an issues when I want to write a balance assertion. Either I'd like to only assert the amount for one currency/commodity, or all of them.

I did not find a way to express multiple currencies in a balance statement, and specifying only a single one will let ledger complain that there is more in that account (which is correct). Ideally, something like

2015/01/01 Balance
Assets::Stock = (3 AAPL + 5 GOOGL + 3 MSFT)
Assets::Cash = (50.00 USD + 25.00 CHF + 15.00 EUR)

Alas, this is no valid syntax. Is there a way to assert such balance amounts ?

thanks,
--paf

complex numbers in annualize_returns

Original report by clemente (Bitbucket: clemente, GitHub: clemente).


There's this part in function annualize_returns (returns.py) where you do:

    return {currency: return_ ** exponent
            for currency, return_ in returns.items()}

In one case I found it trying to do this operation, with this result:

ipdb> (-0.6399327827097466)**0.16666666666666666
(0.8039326954619311+0.4641507581352873j)

beancount "still" doesn't support imaginary values (quantum accounting? That sounds like a new hype), so that shocked me as strange. It happens in some particular dates+amounts combinations and I couldn't create a test case easily, but I can create one if you feel there can be other errors. You could also add asserts that help debug this before it happens.

Maybe it's possible to keep the sign outside the exponent:

ipdb> (-0.6399327827097466)/abs(-0.6399327827097466) * abs(-0.6399327827097466)**0.16666666666666666
-0.9283015162705747

Bring back inference of tolerance using cost

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


On Tue, May 19, 2015 at 1:41 AM, Matthew Harris [email protected] wrote:
On Monday, May 18, 2015 at 6:22:07 PM UTC-7, Martin Blais wrote:
The gist of it is that the error should not be suppressed because of the insertion of the rounding errors. After I fix this bug, the same error should show up with or without the rounding option.

Noooo! :-( I hoped that this would eliminate the need for me to manually add rounding to each transaction.

This was a $5000.00 transaction; that's exactly how much money came out of the checking account. And $97.98 is the share price on the account statement; I don't want to fudge that. At that price, I get 51.031 shares. (The number of shares is rounded to the nearest 0.001.) And yes, 51.031 shares at $97.98 each is worth almost $0.02 more than I paid. But if they had given me only 51.030 shares, I'd be $0.08 short.

I had hoped that the transaction tolerance would be max(0.005 USD, 0.0005 shares * 97.98 USD/share) = 0.05 USD, because that's what I seem to have experienced with multiple financial companies over more than a decade. Usually I have to add or subtract a penny or two. On rare occasions it's a bit more. On transactions where a cash amount is used to buy shares of multiple commodities, the errors accumulate, a penny or two per commodity.

I tried this method, I spent the better part of a day implementing it and trying to resolve problems with it and experimenting. In many cases it resulted in too large tolerances or too small ones. I can't remember all the details right now, but I kept all the code around.

I could easily add an experiment flag so you can test it out. I'll do that so you can give it a whirl.

bean-web should render numbers using display_context

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


o 150 EUR or 150.00 EUR is in the ledger. To me two different results
depending on what I input. Shouldn't it be consistent? Either 150 EUR or
150.00 EUR any time? I'd prefer the last.

These should parse and produce the same number internally.
There really should be no difference between them.

Do you have a file that reproduces this problem?

Yes:
bean-web double_zero_no_decimals
produces attached HTML

Ah yes! I remember now. I have some code which formats all numbers of a particular currency to the same number of digits internally (it tabulates statistics on the input and uses the most common number of digits). The code is in beancount.core.display_context. The thing is, I never converted bean-web to use this.

I have to do this eventually, so that it looks more consistent. (BTW, I haven't put a ton of care into bean-web, I think it probably needs to receive another design iteration at this point.)

mandarine:~/u/Downloads$ cat double_zero_no_decimals
2015-04-01 open Assets:Bank:DE:Comdirekt:Giro
2015-04-01 open Equity:PrivAdd

2015-04-10 ! "Einlage B7"
Assets:Bank:DE:Comdirekt:Giro 15.00 EUR
Equity:PrivAdd

2015-04-10 ! "Einlage B7"
Assets:Bank:DE:Comdirekt:Giro 15 EUR
Equity:PrivAdd

Watch included files for re-read too

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


One question: previously, if I wrote to the beancount file that a bean-web process was already using, and if I hit refresh, bean-web noticed the update to the file and re-read. This still works now, but only on the including file, not on the included files. Is this a pain to fix, or relatively easy?

Oops, hadn't thought about that one.

I guess I'll need to add this bit then:
https://bitbucket.org/blais/beancount/src/4c630c581565f97b28691a67dde52728a24541fb/src/python/beancount/loader.py?at=default#cl-179

And modify the web app so that it detects it for a set of files here:
https://bitbucket.org/blais/beancount/src/4c630c581565f97b28691a67dde52728a24541fb/src/python/beancount/web/web.py?at=default#cl-896

(from redstreet0, thread "Beancount Updates 2015-02-01")

Zero-cost assets not included in unrealized gains

Original report by clemente (Bitbucket: clemente, GitHub: clemente).


If I get new units gifted, they aren't included in the unrealized gains.

plugin "beancount.plugins.unrealized"

1970-01-01 open Assets:Stocks:NYA
1970-01-01 open Expenses:Financial:Commissions
1970-01-01 open Assets:Current
1970-01-01 open Earnings:Dividends:NYA

2010-01-10 ! "Buy"
  Assets:Stocks:NYA 20 NYA {15 EUR}
  Expenses:Financial:Commissions 10 EUR
  Assets:Current -310 EUR

2012-07-02 ! "I received 1 new share in dividend, without paying"
  Assets:Stocks:NYA 1 NYA {0 EUR}
  Earnings:Dividends:NYA -0 EUR

2014-11-13 balance Assets:Stocks:NYA 21 NYA
2014-11-13 price NYA 16 EUR ; I should have (* 16 21) = 336 EUR

I saw:

Unrealized gain for 20 units of NYA (price: 16.0000 EUR as of 2014-11-13, average cost: 15.0000 EUR)

Instead of „… for 21 units“. Average cost should alse have gone down from 15.

bean-doctor context command should support a separate top-level file for running and as an argument for querying

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


This raises the point that bean-doctor may have some problems in a world with "include" statements, since right now it doesn't support providing both a top-level beancount file and the file-and-line of interest.

Matthew

On Wednesday, February 11, 2015 at 9:20:17 PM UTC-8, Martin Blais wrote:
Bug in "bean-doctor context" fixed, in large part thanks to Matthew:
#17/bean-doctor-context-broke-in-revision
https://bitbucket.org/blais/beancount/commits/18c5e6391e42e441451642a221bf8a6f8a2f2909

On Wed, Feb 11, 2015 at 9:41 PM, Matthew Harris [email protected] wrote:
On Wednesday, February 11, 2015 at 1:04:51 PM UTC-8, Aaron Bull Schaefer wrote:
On Wednesday, February 11, 2015 at 10:54:46 AM UTC-8, Matthew Harris wrote:
I'm sure this is because when you transferred out of those accounts, you subtracted the shares but not the cost basis. See this earlier message with a fix:

https://groups.google.com/d/msg/beancount/2Y7EWFUA3OA/OWKd5puxCN0J

Ah hah! That's exactly what I'm seeing. When I was transferring out, I was just doing something like:

2013-08-07 * "Backdoor transfer"
Assets:Investments:Vanguard:Traditional-IRA:VTIVX -758.68036 VTIVX {16.56 USD}
Assets:Investments:Vanguard:Roth-IRA:VTIVX 758.68036 VTIVX {16.56 USD}

...which should have brought my Traditional IRA's VTIVX down to zero. So I know the problem, and I see the syntax to fix it, but how do you calculate the cost basis that should be used for each of these types of transactions? I think I'll have a handful that need to be updated. For some reason, the bean-doctor context ledger.bean 123 is just reporting "No entry could be found before ledger.bean:123".

The cost basis is just the sum of (num_shares * cost_per_share) of all transactions before that point -- basically the net amount of money you've put into the account, excluding unrealized gains.

"bean-doctor context" appears to have broken recently. Martin, I've narrowed it down to https://hg.furius.ca/public/beancount/rev/ba5032375ba8. I'll file a bug.

Decimal-None in unrealized gains with cost 0

Original report by clemente (Bitbucket: clemente, GitHub: clemente).


plugin "beancount.plugins.unrealized"

2001-01-01 open Assets:BAC
2001-01-01 open Assets:Cash
2001-01-01 open Income:BAC
2001-01-01 open Equity:NotYetAccounted


2013-05-20 pad Assets:BAC Equity:NotYetAccounted
2013-05-20 balance Assets:BAC 14 BAC

2013-06-30 ! "My 14 gifted shares are sold"
  Assets:BAC -14 BAC {0 EUR} @@ 7.64 EUR
  Assets:Cash 7.64 EUR
  Income:BAC

I get:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/lib/python3/dist-packages/bottle.py", line 1729, in wrapper
    rv = callback(*a, **ka)
  File "/w/beancount/src/python/beancount/web/web.py", line 912, in wrapper
    entries, errors, options_map = loader.load_file(filename)
  File "/w/beancount/src/python/beancount/loader.py", line 57, in load_file
    return _load([(filename, True)], log_timings, log_errors, extra_validations)
  File "/w/beancount/src/python/beancount/loader.py", line 221, in _load
    entries, errors = run_transformations(entries, parse_errors, options_map, log_timings)
  File "/w/beancount/src/python/beancount/loader.py", line 292, in run_transformations
    entries, plugin_errors = callback(entries, options_map)
  File "/w/beancount/src/python/beancount/plugins/unrealized.py", line 105, in add_unrealized_gains
    pnl = holding.market_value - holding.book_value
TypeError: unsupported operand type(s) for -: 'decimal.Decimal' and 'NoneType'

The test case above is simplified (in real life I should have received those 0 EUR first), but my original transactions where this happes crash in the same way.

Cost currency same as unit currency will fail with an assertion, not a reported error

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


  • BUG: This will fail with an assertion, should be an error instead:

    2014-11-01 * "Massdrop Group Inc." | "Express Checkout Payment Sent"
    Expenses:Toys:Electronics 146.37 USD @@ 169.87 USD
    Assets:CA:PayPal -169.87 CAD

#!python

bean-check /tmp/test.beancount
Traceback (most recent call last):
  File "/home/blais/p/beancount1/src/python/beancount/parser/parser.py", line 776, in transaction
    balance_errors = balance_incomplete_postings(entry)
  File "/home/blais/p/beancount1/src/python/beancount/core/interpolate.py", line 238, in balance_incomplete_postings
    postings, inserted, errors = get_incomplete_postings(entry)
  File "/home/blais/p/beancount1/src/python/beancount/core/interpolate.py", line 151, in get_incomplete_postings
    balance_amount = get_posting_weight(posting)
  File "/home/blais/p/beancount1/src/python/beancount/core/interpolate.py", line 49, in get_posting_weight
    return posting.position.get_weight(posting.price)
  File "/home/blais/p/beancount1/src/python/beancount/core/position.py", line 239, in get_weight
    "Invalid currency for price: {} in {}".format(self, price))
AssertionError: Invalid currency for price: 146.37 USD in 1.160552025688324110131857621 USD


Setting account_rounding affects the outcome of balance assertions

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


On Mon, May 18, 2015 at 7:40 PM, Matthew Harris [email protected] wrote:
On Sunday, May 17, 2015 at 1:27:54 PM UTC-7, Martin Blais wrote:
* Rounding errors may be automatically posted to a special account (new
postings are inserted during parsing where necessary). This is disabled by
default; you enable this by setting the new 'account_rounding' option to
the account you want the rounding errors to be posted to:

    option "account_rounding" "Equity:Rounding-Errors"

This and the new Precision & Tolerances document suggest to me that whether we enable this option should not affect whether transactions balance,

That is correct.

but that doesn't seem to match with my experience.

That sounds like a bug to me.

I was able to enable this option and remove all my old manual Expenses:RoundingErrors postings, which seemed great. But if I commented out this option, I got lots of "Transaction does not balance" errors. Example:

Transaction does not balance: (0.01738 USD)
2002-02-08 * "Mutual fund purchase"
* Assets:Investments:MutualFunds:XXX 51.031 XXX {97.98 USD}
Assets:Cash:Checking -5000.00 USD

Am I reading the document wrong?

You're reading it right (as usual).

Using your example transaction, I've been able to reproduce the bug right away.
And I will fix this!
I'm surprised this didn't come up before (and slightly ashamed I didn't detect this one before, I did work on this feature a lot).
Thanks for reporting this right away.

The gist of it is that the error should not be suppressed because of the insertion of the rounding errors. After I fix this bug, the same error should show up with or without the rounding option.

Please note your "rounding error" is much larger than a regular rounding error... it's on the order of 2 cents which is well above inferred threshold:

bean-doctor context /home/blais/p/beancount-data/bug-reports/mharris/2015-05-18.precision.beancount 6
Hash:5b6e563ce80781d7f2338f50f878149a
Location: /home/blais/p/beancount-data/bug-reports/mharris/2015-05-18.precision.beancount:5

2002-02-08 * "Mutual fund purchase"

  • Assets:Investments:MutualFunds:XXX 51.031 XXX {97.98 USD} ; 5000.02 USD
    Assets:Cash:Checking -5000.00 USD ; -5000.00 USD
    Equity:Rounding-Errors -0.02 USD ; -0.02 USD

;;; Precision: USD=0.005, XXX=0.0005

So using the plugin will not allow you to remove your explicit rounding booking... you should instead use a more precise conversion price. If that's inappropriate, then you actually made 2 cents in real life, and that should be accounted for as a gain.

bean-example fails - unit test succeeds, running the script fails

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


nosetests3 /home/blais/p/beancount/src/python/beancount/scripts/example_test.py
flex scanner push-back overflow

While running bean-example I get this error:

INFO    : Writing contents
Traceback (most recent call last):
  File "/usr/bin/bean-example", line 2, in <module>
    from beancount.scripts.example import main; main()
  File "/usr/lib/python3.4/site-packages/beancount/scripts/example.py", line 1743, in main
    file=output_file)
  File "/usr/lib/python3.4/site-packages/beancount/scripts/example.py", line 1693, in write_example_file
    file.write(contents)
UnicodeEncodeError: 'ascii' codec can't encode character '\xae' in position 1192: ordinal not in range(128)

--
Evan Farrell
Full Stack Engineer
Professional Taster
Analytical Flavor Systems, LLC.

crash with use_legacy_fixed_tolerances True

Original report by clemente (Bitbucket: clemente, GitHub: clemente).


When using

option "use_legacy_fixed_tolerances" "TRUE"

I get:

Traceback (most recent call last):
  File "/w/beancount/src/python/beancount/parser/parser.py", line 806, in transaction
    balance_errors = balance_incomplete_postings(entry, self.options)
  File "/w/beancount/src/python/beancount/core/interpolate.py", line 364, in balance_incomplete_postings
    residual, tolerances) = get_incomplete_postings(entry, options_map)
  File "/w/beancount/src/python/beancount/core/interpolate.py", line 314, in get_incomplete_postings
    quantum = (tolerance * 2).normalize()
AttributeError: 'str' object has no attribute 'normalize'

If you need I create a test case.

Make it easy to filter out transactions in the future

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


BTW that's a totally legit example, I haven't done this myself yet, but I would like to. I need to give this a shot in my own file and fix all the problesm encountered.

On Wed, Jun 10, 2015 at 2:13 PM, Martin Blais [email protected] wrote:
You're talking about bean-query?
I could add a TODAY() function and then you could filter using date < TODAY().
I think you can already use the CLOSE ON to remove the future transactions.

bean-web doesn't have such capability yet, the right thing to do is to rework it to accept an arbitrary filtering expression and show all the views based on that. I haven't gotten to it yet. So much to do ...

On Mon, Jun 8, 2015 at 1:58 PM, Jon Stahl [email protected] wrote:
Oh, and FWIW a suggestion:

I would like to enter all the future vesting events now and only see totals up to the current date.
However when I select year 2015 I get future transactions.
It would be nice if there were a way to do "YTD" only ...

Regards,
Jon

ImportError: Module 'curses' is not installed

Original report by Saša Janiška (Bitbucket: gour, GitHub: gour).


While working on tutorial, I've encountered the following:

#!python

gour@atmarama ~/financije> bean-report example.beanaccount journal -a Assets:US:BofA:Checking
Traceback (most recent call last):
  File "/usr/bin/bean-report", line 2, in <module>
    from beancount.scripts.report import main; main()
  File "/usr/lib64/python3.4/site-packages/beancount/scripts/report.py", line 225, in main
    chosen_report.render(entries, errors, options_map, args.format, outfile)
  File "/usr/lib64/python3.4/site-packages/beancount/reports/report.py", line 114, in render
    result = render_method(entries, errors, options_map, outfile)
  File "/usr/lib64/python3.4/site-packages/beancount/reports/report.py", line 219, in forward_method
    return fwdfunc(self, real_root, options_map, file)
  File "/usr/lib64/python3.4/site-packages/beancount/reports/journal_reports.py", line 81, in render_real_text
    self._render_text_formats(real_root, options_map, file, journal_text.FORMAT_TEXT)
  File "/usr/lib64/python3.4/site-packages/beancount/reports/journal_reports.py", line 68, in _render_text_formats
    width = self.args.width or misc_utils.get_screen_width()
  File "/usr/lib64/python3.4/site-packages/beancount/utils/misc_utils.py", line 303, in get_screen_width
    import curses
  File "/usr/lib64/python3.4/_import_failed/curses.py", line 17, in <module>
    to install it.""".format(__name__, package))
ImportError: Module 'curses' is not installed.
Use:
  sudo zypper install python3-curses
to install it.

Don't know if it's openSUSE or general issue, but isntalling python3-curses does help.

Confusing error message: "Amount is zero or negative"

Original report by Matthew Harris (Bitbucket: matthew_harris, GitHub: mharris312).


2000-01-01 open Assets:Investments:IRA:XXX
2000-01-01 open Income:Investments:IRA:PnL
2014-12-29 *

  • Assets:Investments:IRA:XXX 0.000 XXX {18.87 USD}
    Income:Investments:IRA:PnL

This results in the following error:

$ bean-check test.beancount
test.beancount:4: Amount is zero or negative: 18.87 USD

This is confusing because 18.87 USD is not zero or negative.

treeify fails with very very long account names

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


  1. I like how you split treeify and bean-report, however, this is causing it to not work for me. I have some rather long account names, and as a result the number of spaces between the account name and the amount isn't enough for treeify to known where to split.

As a workaround I'm using (hooray for Unix utils!):

bean-report ledger.bean bal | sed -e 's/\s\s*/\t/' | expand -t 50 | treeify

bean-web does not watch all the included files, just the top-level one

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


  • BUG: When multiple files have been loaded, have bean-web watch all the
    loaded files.

     "One question: previously, if I wrote to the beancount file that a
    

    bean-web process was already using, and if I hit refresh, bean-web noticed
    the update to the file and re-read. This still works now, but only on the
    including file, not on the included files. Is this a pain to fix, or
    relatively easy?"

In exportpf report, add an option to aggregate postings by currency

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


For more detailed tracking, what I'm doing at the moment is a "bean-report exportpf > /tmp/file.ofx" and then import that into Google Finance. It's a bit annoying because I don't have groups of accounts and it requires some manual steps.

Heh. My portfolio still crashes Google Finance for some reason (and gives an unhelpful "Not Found" error). I never bothered to bisect my file to try to pin down the reason. I suspect it would be difficult. (How big is your ofx file? Mine is 960 KB, and the import page takes a long time to load, so I wonder it's just too big. But I'm sure you also have a large file.)

About 88K. Wow you have a lot of holdings.

Something easy could be done to fix that: the export script could be modified to aggregate holdings for the same account + currency at the average cost basis.

unrealized.py: "A valid price could not be found" warnings for leaked cost basis

Original report by Matthew Harris (Bitbucket: matthew_harris, GitHub: mharris312).


Quoting yourself:
As for the
"A valid price for ABC/USD could not be found"
message: it is emitted from the unrealized gains plugin.
I'll have to hunt it down, sounds like a bug.

This is indeed, a bug triggered by this situation and I'll have to fix it.
The unrealized gains plugin computes the list of holdings in order to insert the gains, and it ends up with a holding object like this for your leaked cost basis:

#!python

Holding(account='Assets:Investments:RolloverIRA:ABC', number=Decimal('0.000'), currency='ABC', cost_number=None, cost_currency='USD', book_value=Decimal('-8222.48552000000000000000000'), market_value=None, price_number=None, price_date=datetime.date(2013, 4, 1))

Now, it expects that if the commodity is not a currency, it will have a price. But price_number is None, so it complains about it.
I'll fix this over the weekend; it should be silent when that occurs, I'll have to find conditions for that.

"print from close_date" causes problems on account open

Original report by Matthew Harris (Bitbucket: matthew_harris, GitHub: mharris312).


I'm not sure what all is going on here, but I'm sure it'll be pretty obvious to you.

#!

$ cat test.beancount
2000-01-01 open Assets:Checking
$ bean-query test.beancount 'print from close_date("XXX");'
Traceback (most recent call last):
  File "/Users/mharris/homebrew/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'BQLShell' object has no attribute 'do_print'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/query/shell.py", line 223, in default
    self.dispatch(statement)
  File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/query/shell.py", line 213, in dispatch
    return method(statement)
  File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/query/shell.py", line 284, in on_Print
    query_execute.execute_print(c_print, self.entries, self.options_map, file)
  File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/query/query_execute.py", line 73, in execute_print
    entries = filter_entries(c_print.c_from, entries, options_map)
  File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/query/query_execute.py", line 57, in filter_entries
    for entry in entries
  File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/query/query_execute.py", line 58, in <listcomp>
    if c_expr(entry)]
  File "/Users/mharris/homebrew/lib/python3.4/site-packages/beancount/query/query_env.py", line 156, in __call__
    close_entry, close_entry = context.open_close_map[args[0]]
AttributeError: 'Open' object has no attribute 'open_close_map'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.