Re: Help needed to document ledger options
Hi Alexis, Nice work. Is something like this possible for formatting handlers as well. I was trying lately to use the roundto primitive, but could not work out how to use it. Did not find anything in the documentation. Trial and error resulted in a segmentation fault. Best Regards, Hans Erik Op donderdag 15 januari 2015 22:34:10 UTC+1 schreef unices: Hello everyone, I have pushed some changes to the next branch that break the tests. This is because I have integrated the test/CheckTests.py script into the test suite and it shows areas where ledger can be improved. The script checks whether all options know to ledger are documented in the manpage (doc/ledger.1) and in the manual (doc/ledger3.texi), and whether there are options documented in those files that aren't supported by ledger. Please find below a list of errors reported by test/CheckTests.py, if you know what (some of) those options do I kindly ask you to to write a short documentation and issue a pull request on github or respond to this mail, so we can improve the documentation. In order to document options in the manpage follow the given mdoc (7) formatting: .It Fl \-option-to-document I have commented many undocumented options running the following command will show you which those are: % grep '.\.It Fl' doc/ledger.1 To test the options documented in the manual I have expanded test/CheckTets.py so that it searches for lines with @c option, e.g.: @item --help @c option There are also several FIXME's in doc/ledger3.texi, that need, well fixing ;) Should you document an option in the manual please add the string `@c option` to it, so that CheckTests.py can verify it and search for the option in the whole manual, it may be documented in several places. Thanks! Alexis Here's the output of: % python test/CheckTests.py --ledger ${PATH_TO}/ledger --source . Missing man page entries for: --auto-match --base --cache --day-break --exact --explicit --full-help --help-calc --help-comm --help-disp --import --lots-actual --no-pager --permissive --revalued --revalued-only --revalued-total --rich-data --sort-all --time-report --value-expr --verify-memory Missing texi entries for: --auto-match --base --cache --datetime-format --day-break --exact --full-help --help-calc --help-comm --help-disp --import --lots-actual --no-pager --permissive --revalued --revalued-only --revalued-total --rich-data --sort-all --time-report --value-expr --verify-memory Texi entry for unknown option: --getquote -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help needed to document ledger options
Hi Erik Nice work. Thanks :) I stand on the should of giants. Is something like this possible for formatting handlers as well. Maybe, I'm not sure yet. I would like to have every aspect of Ledger (including formatting handlers) documented and have that documentation tested and validated by ledger. I was trying lately to use the roundto primitive, but could not work out how to use it. Did not find anything in the documentation. Trial and error resulted in a segmentation fault. Ah a segmentation fault, gotta love those ;) Please check if the one you found has already been reported to bugs.ledger-cli.org and report it if it hasn't giving step-by-step instructions and test data to reproduce the issue. It would be super helpful. And can you give an example of what documentation you would've considered helpful? This could give me a start on how that documentation may be written, tested and validated. Best, Alexis -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
documenting formatting handlers Re: Help needed to document ledger options
created a new thread as to not blowup your option handling thread. And can you give an example of what documentation you would've considered helpful? This could give me a start on how that documentation may be written, tested and validated. list of formatting handlers: - foo(x,y): one line description foo performs ... and takes an argument x that controls ... and argument y that ... one line example of a typical use foo(amount,2) results in amount to be displayed fooed a level of 2 times - bar(x): ... Op vrijdag 16 januari 2015 17:36:30 UTC+1 schreef unices: Hi Erik Nice work. Thanks :) I stand on the should of giants. Is something like this possible for formatting handlers as well. Maybe, I'm not sure yet. I would like to have every aspect of Ledger (including formatting handlers) documented and have that documentation tested and validated by ledger. I was trying lately to use the roundto primitive, but could not work out how to use it. Did not find anything in the documentation. Trial and error resulted in a segmentation fault. Ah a segmentation fault, gotta love those ;) Please check if the one you found has already been reported to bugs.ledger-cli.org and report it if it hasn't giving step-by-step instructions and test data to reproduce the issue. It would be super helpful. And can you give an example of what documentation you would've considered helpful? This could give me a start on how that documentation may be written, tested and validated. Best, Alexis -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to view both number of items and their price in balance report.
Hello Ivanov Dmitry on Wed, Jan 14, 2015 at 09:55:30PM CET, you wrote: Is it possible to get the sum of money, spent on that: 22 GAL $44 Expenses:Gasoline Yes, that's possible by changing the balance format using the --balance-format option (see the manual¹ for details), here's an example: % ledger -f test1.txt \ --exchange $ \ --format \ '%(strip(amount)) %(display_amount) %(ansify_if(account, blue))\n' \ bal expenses 22 GAL $44 Expenses:Gasoline Cheers, Alexis ¹ http://ledger-cli.org/3.0/doc/ledger3.html#index-_002d_002dbalance_002dformat-FORMAT_005fSTRING-1 -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Monthly Liabilities
Hi all, I have a new question: Currently I would like to optimize my Journal File so that monthly liabilities do not need to be written every month. Thus my former preamble of the Journal file: 2015/01/01 * Opening balances for January 2015 Assets:Checking €2500.00 Liabilities:MasterCard €-200 Liabilities:Savings€-250.00 Liabilities:Rent€-600.00 Liabilities:Loan €-120.00 Equity I have changed to this one: ~ Monthly from 2014/12/01 Liabilities:Savings€-250.00 Liabilities:Rent€-600.00 Liabilities:Loan€-120.00 Assets 2015/01/01 * Opening balances for January 2015 Assets:Checking €2500 Liabilities:MasterCard €-200 Equity Lets say, that I had a later transaction where I payed my rent: 2015/01/10 * Rent Liabilities:Rent €600.00 Assets:Checking If I check the Balance reports, I get for the first version this one: €1900.00 Assets:Checking €-1330.00 Equity €-570.00 Liabilities €-120.00Loan €-200.00MasterCard €-250.00Savings 0 but for the second version that one: €1900.00 Assets:Checking €-2300.00 Equity €400.00 Liabilities €-200.00MasterCard €600.00Rent 0 Thus though I see that I spent my rent the monthly liabilities are not expressed in the report. Can someone tell me where I make an error? Best, Philipp -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Monthly Liabilities
Or, you could use the scheduling capabilities in ledger-mode. On Fri, Jan 16, 2015 at 4:17 PM, Phil Gee philipp.gi...@googlemail.com wrote: Hi all, I have a new question: Currently I would like to optimize my Journal File so that monthly liabilities do not need to be written every month. Thus my former preamble of the Journal file: 2015/01/01 * Opening balances for January 2015 Assets:Checking €2500.00 Liabilities:MasterCard €-200 Liabilities:Savings€-250.00 Liabilities:Rent€-600.00 Liabilities:Loan €-120.00 Equity I have changed to this one: ~ Monthly from 2014/12/01 Liabilities:Savings€-250.00 Liabilities:Rent€-600.00 Liabilities:Loan€-120.00 Assets 2015/01/01 * Opening balances for January 2015 Assets:Checking €2500 Liabilities:MasterCard €-200 Equity Lets say, that I had a later transaction where I payed my rent: 2015/01/10 * Rent Liabilities:Rent €600.00 Assets:Checking If I check the Balance reports, I get for the first version this one: €1900.00 Assets:Checking €-1330.00 Equity €-570.00 Liabilities €-120.00Loan €-200.00MasterCard €-250.00Savings 0 but for the second version that one: €1900.00 Assets:Checking €-2300.00 Equity €400.00 Liabilities €-200.00MasterCard €600.00Rent 0 Thus though I see that I spent my rent the monthly liabilities are not expressed in the report. Can someone tell me where I make an error? Best, Philipp -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Craig, Corona De Tucson, AZ enderw88.wordpress.com -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Monthly Liabilities
Phil Gee philipp.gi...@googlemail.com writes: Thus though I see that I spent my rent the monthly liabilities are not expressed in the report. Can someone tell me where I make an error? Periodic transactions are only for budgeting and forecasting. They do not constitute real transactions. John -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Computing investment returns
Hi all, I'm trying to figure out how I can compute investment returns for a given period using ledger. By investment returns, I mean the usual. I think this page calls it Investor return: http://www.bogleheads.org/wiki/Calculating_personal_returns I was thinking there would be a bunch of other folks here in the same boat, and so, I was hoping to not reinvent the wheel. Any homebrewed solutions or pointers welcome. Thanks in advance! -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Computing investment returns
Here is some code I use: https://bitbucket.org/blais/beancount/src/tip/src/python/beancount/projects/returns.py?at=default Incomplete documentation (but you get the idea): https://docs.google.com/document/d/1vEFB44-HFqydYVJXA-QxT4AN0K5xHHfSkhTmRSCPkac/edit#heading=h.74ct9toigxjp Run it in verbose mode and it will spit out all the detail, for all the periods between external flows. There are a few kinks, but it mostly works. Takes into account capital gains, dividends and fees if you organize your account names right. (I just realized I forgot to complete the explanatory document, will do that soon.) On Fri, Jan 16, 2015 at 8:28 PM, Red Street redstre...@gmail.com wrote: Hi all, I'm trying to figure out how I can compute investment returns for a given period using ledger. By investment returns, I mean the usual. I think this page calls it Investor return: http://www.bogleheads.org/wiki/Calculating_personal_returns I was thinking there would be a bunch of other folks here in the same boat, and so, I was hoping to not reinvent the wheel. Any homebrewed solutions or pointers welcome. Thanks in advance! -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Computing investment returns
I think http://hackage.haskell.org/package/hledger-irr is another tool for that ? -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Computing investment returns
Excellent. Thanks much, Martin, and Simon. Precisely what I was looking for. I'm not setup with hledger currently, though I've tried it in the past, so I'll start with Martin's solution for now. Martin: from just looking at the code, it seems like I don't even need to run ledger or beancount, since this simply parses the journal file directly? Also again, looking at your code, it builds up a pricedb as it goes along if one wasn't supplied, but does it end up taking the last known value for a stock on the final day of the period under consideration? Can I give it a pricedb of just the last day in the period, since in theory, that's all is needed? Question about granularity: if I have n different commodities I bought, is it possible to compute the return for each commodity separately? And if I have n different investment accounts (say, a retirement account, and a non-retirement account), should I run this on these accounts separately if I want to know their individual returns? Thanks much again! -- --- You received this message because you are subscribed to the Google Groups Ledger group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Computing investment returns
On Fri, Jan 16, 2015 at 11:01 PM, Red Street redstre...@gmail.com wrote: Excellent. Thanks much, Martin, and Simon. Precisely what I was looking for. I'm not setup with hledger currently, though I've tried it in the past, so I'll start with Martin's solution for now. Martin: from just looking at the code, it seems like I don't even need to run ledger or beancount, since this simply parses the journal file directly? This is a bit of an oblique question; let me clarify what I mean by this: it uses Beancount. It uses its loader to parse and load the input file (where parse means to produce data structures that match 1:1 to the input, and load means further process this list with plugins which may themselves generate more directives or modify those, and then validates various things). This forms the entire input part of Beancount, including all its semantics; it always begins with load_file(). But essentially, that _is_ most of what Beancount is. Everything else is just different tools built on top of this produced list to extract different aggregations and filters (bean-web, bean-report, bean-query, or a custom script). In this case, this is a custom script, it runs through the loaded data structure (a list of directive objects) to filter out a subset of transactions and compute returns from them: https://bitbucket.org/blais/beancount/src/9aa7842c801b02a5ddc70177ca69927310ea8565/src/python/beancount/projects/returns.py?at=default#cl-850 About parse vs. load: https://bitbucket.org/blais/beancount/src/9aa7842c801b02a5ddc70177ca69927310ea8565/src/python/beancount/loader.py?at=default#cl-107 Also again, looking at your code, it builds up a pricedb as it goes along if one wasn't supplied, but does it end up taking the last known value for a stock on the final day of the period under consideration? Can I give it a pricedb of just the last day in the period, since in theory, that's all is needed? The price database is always automatically created from a list of loaded entries: https://bitbucket.org/blais/beancount/src/9aa7842c801b02a5ddc70177ca69927310ea8565/src/python/beancount/projects/returns.py?at=default#cl-627 https://bitbucket.org/blais/beancount/src/9aa7842c801b02a5ddc70177ca69927310ea8565/src/python/beancount/ops/prices.py?at=default#cl-57 You don't need to do anything special to get a price map in the code. Price entries are created either implicitly as a result of postings with cost ({...}) or with price conversions (@ ...), or explicitly as directives, e.g. 2015-01-06 price HOOLI 505.23 USD. You can use bean-report filename print to view the list of generated price directives after loading. To answer your question about prices and dates: the price database will interpolate from the last seen price. It would be wise to add price points on the dates where you have external flows, for all the commodities you're holding at that date, as well as the dates where you intend to start/stop calculating the returns. (One further improvement I want to add is an automated warning when prices are interpolated too far from their sample points, to let the user know which price points should be manually inserted in order to compute the returns most precisely. Interpolation does an okay job to get a good approximation, but it would be nice if the script would help us adding the missing prices; I thought it could produce a list of Price directives with zero values and another script could eventually fetch all those missing prices.) Question about granularity: if I have n different commodities I bought, is it possible to compute the return for each commodity separately? And if I have n different investment accounts (say, a retirement account, and a non-retirement account), should I run this on these accounts separately if I want to know their individual returns? Yes, and yes, but with a caveat. You have to create clearly segregated accounts in order to achieve this level of separation, but IMO that is congruent with good chart-of-account design. For example, if you wanted to compute the returns for a particular commodity with dividends (and include the dividends in its return), you would have to either (a) have an income account defined specifically for that commodity,e.g. Income:US:Ameritrade:Dividends:HOOLI, or (b) if you use a more general account to book that income, e.g., Income:US:Ameritrade:Dividends for all dividends from an Ameritrade account, then you'd have to filter and compute only off of entries that are pertinent to your commodity, that is, that include only those dividends received as a consequence of holding a position in that commodity and not those that pertain to dividends received for other commodities (this isn't entirely obvious to import, since unlike capital gains, dividends will typically only have postings on the income account to the cash accounts, so it's usually something in the memo (description) string of your imported transaction that tells you for which