Re: Matching trades with complex tax rules
On Monday, 22 February, 2021 at 2:26:12 pm UTC+5:30 dan.s...@gmail.com wrote: > I never use @ or @@ to specify lot prices. Have you out the trading accounts method? https://github.com/ledger/ledger/wiki/Multiple-currencies-with-currency-trading-accounts It still requires calculation of realized capital gains by hand, but it can at least help you automatically calculate _unrealized_ capital gains. > Unfortunately that means I also have to manually build a price database. There is one downside to using the prices database for transaction prices (as opposed to market prices): You can normally have multiple transactions in a single day with different prices for different transactions. But if you're using the prices database, then you can't (since you can't specify time in transactions nor in the prices database). -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/01e462cc-4349-498e-bc03-6842b1030e63n%40googlegroups.com.
Re: Summable account balances
* Dan Sladden [2021-02-22 05:36]: > But with --flat --no-total I get this: >$-150 Assets:Cash > $150 Assets:One > $50 Assets:One:Two > which doesn't because the balance for Assets:One includes that of > Assets:One:Two. This is imho a bug in --flat. I ran into this recently and opened this issue: https://github.com/ledger/ledger/issues/1987 As a workaround, you could run multiple ledger bal commands and combine the output into one file. You would run: ledger bal ACCOUNT$ The $ indicating end of string, i.e. without subaccounts. -- Martin Michlmayr https://www.cyrius.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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/20210223013501.GD3650%40jirafa.cyrius.com.
Re: Year end date
On Mon, Feb 22, 2021 at 3:36 PM Dan Sladden wrote: > > Apologies - I'm not being very clear. I'm trying to total the entries for the > whole financial year that ends on (in my case) 5 April. > > This is the output of for example ledger broadband --yearly > '2019-01-01' - '2019-12-31' Expenses:Utilities:Broadband > £ 350.14 £ 350.14 > '2020-01-01' - '2020-12-31' Expenses:Utilities:Broadband > £ 463.85 £ 813.99 > '2021-01-01' - '2021-12-31' Expenses:Utilities:Broadband > £ 40.34 £ 854.33 > > But what I want is this: > '2019-04-06' - '2020-04-05' Expenses:Utilities:Broadband > £ 465.58 £ 465.58 > '2020-04-06' - '2021-04-05' Expenses:Utilities:Broadband > £ 388.75 £ 854.33 > ledger reg -f /whereever/you/store/ledger'name'.dat --limit 'account =~Expenses:Utilities:Broadband -b 2014.04.06 -e 2015.04.05 I modified what I sent earlier to the dating you're looking for. What I do not know is if that phrase 'Expenses:Utilities:Broadband' is the actual 'account name - - - - I use numbers. You may have to experiment with the =~ part of the command. If you run the years inline without closing each one out (I don't see the need but ymmv) the search really doesn't care what you beginning and ending dates are - - - - just enter them. Now if you're entering your records so that one set ends on dec 31st and the next starts on jan 1st - - - - - well then things won't be so easy. HTH -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CAPpdf5-Xeh-O_As%3D23k6tAecjiUC%2B3Z1iTvBaiTBVpo%3Df8eRYQ%40mail.gmail.com.
Re: Year end date
Apologies - I'm not being very clear. I'm trying to total the entries for the whole financial year that ends on (in my case) 5 April. This is the output of for example *ledger broadband --yearly* '2019-01-01' - '2019-12-31' Expenses:Utilities:Broadband £ 350.14 £ 350.14 '2020-01-01' - '2020-12-31' Expenses:Utilities:Broadband £ 463.85 £ 813.99 '2021-01-01' - '2021-12-31' Expenses:Utilities:Broadband £ 40.34 £ 854.33 But what I want is this: '2019-04-06' - '2020-04-05' Expenses:Utilities:Broadband £ 465.58 £ 465.58 '2020-04-06' - '2021-04-05' Expenses:Utilities:Broadband £ 388.75 £ 854.33 John, --group-by 'format_date(date, "%Y")' looks helpful as I could write a function that maps the date onto the financial year (although leap years would be a pain) but it won't aggregate the entries in the same way as --yearly I don't think. Dan On Mon, 22 Feb 2021 at 21:08, John Wiegley wrote: > > "DS" == Dan Sladden writes: > > DS> But none of this does what I want - a single list of tallied > DS> transactions for each financial year from one ledger command. Yes, I > DS> can do it by executing multiple commands with different -b and -e > DS> arguments, but that's IMHO not very elegant. > > Have you tried --group-by 'format_date(date, "%Y")'? > > 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CAJcMy37A2MwzRpX0YhL4vB1CWNk8VWpO4%2B6%3DqUP03PSkyXipcw%40mail.gmail.com.
Re: Year end date
> "DS" == Dan Sladden writes: DS> But none of this does what I want - a single list of tallied DS> transactions for each financial year from one ledger command. Yes, I DS> can do it by executing multiple commands with different -b and -e DS> arguments, but that's IMHO not very elegant. Have you tried --group-by 'format_date(date, "%Y")'? 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/m235xnq0dn.fsf%40newartisans.com.
Re: Year end date
On Mon, Feb 22, 2021 at 11:31 AM Dan Sladden wrote: > > I get all this and I use -b and -e extensively! > > But none of this does what I want - a single list of tallied transactions for > each financial year from one ledger command. Yes, I can do it by executing > multiple commands with different -b and -e arguments, but that's IMHO not > very elegant. > > I like the output of --yearly > I don't like that it has to be 1 Jan through to 31 Dec for each year. > Hmmm - - - -it doesn't 'have to be' Jan 1 to Dec 31! You pick the dates - - - - - YOU. So you want from Oct 1 to Sep 30 - - - - your choice. Not sure what you mean by a 'list of tallied transactions'. The command that I included in my previous email returns a list of all the transactions for that account number in the period specified and includes the total. I think that's what you want. If you are able to give an example of what you're looking for I am positive someone from the list will be able to help you develop the command to achieve such - - - - that has been my experience. As for elegance - - - - I prefer getting the job done quickly, I suppose, so I've not worried about query 'elegance'. HTH -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CAPpdf5_HXFf9NzBWDk3C5jy_y%3DP8DKGh8MqXWv2uAc0LdDZexQ%40mail.gmail.com.
Re: Year end date
I get all this and I use -b and -e extensively! But none of this does what I want - a single list of tallied transactions for each financial year from one ledger command. Yes, I can do it by executing multiple commands with different -b and -e arguments, but that's IMHO not very elegant. I like the output of --yearly I don't like that it has to be 1 Jan through to 31 Dec for each year. :) On Mon, 22 Feb 2021 at 14:40, Kent R. Spillner wrote: > > My solution has been to have a separate ledger file for each tax year > > but that means transferring balances at the end of one year to create > > the new year's file which sometimes leads to issues should anything need > > to be updated in the previous year's records (missing entry, for > > instance). > > Exactly, but you can work around that issue by using the include directive > (see: > https://www.ledger-cli.org/3.0/doc/ledger3.html#Command-Directives). > > For example, I have a script that writes out my year-end balances to the > next year's > directory (I create subdirectories in my top-level directory for every > year) with a > filename of "-opening-balances.ledger" (e.g. > "2021/business-opening-balances.ledger" and > "2021/personal-opening-balances.ledger"). > Then at the top of my "2021/business.ledger" and "2021/personal.ledger" > files I just > "include business-opening-balances.ledger" or > "personal-opening-balances.ledger" > respectively. > > That allows me to go back and automatically overwrite those files to > adjust my opening > balances at any time without having to edit any subsequent transaction. > > > -- > > --- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ledger-cli/1614004814.116413098%40apps.rackspace.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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CAJcMy34E1V6twTB4oV7JQ%3DoT83cEbf3MRsxWm4JvohHiTxC91A%40mail.gmail.com.
Re: Year end date
> My solution has been to have a separate ledger file for each tax year > but that means transferring balances at the end of one year to create > the new year's file which sometimes leads to issues should anything need > to be updated in the previous year's records (missing entry, for > instance). Exactly, but you can work around that issue by using the include directive (see: https://www.ledger-cli.org/3.0/doc/ledger3.html#Command-Directives). For example, I have a script that writes out my year-end balances to the next year's directory (I create subdirectories in my top-level directory for every year) with a filename of "-opening-balances.ledger" (e.g. "2021/business-opening-balances.ledger" and "2021/personal-opening-balances.ledger"). Then at the top of my "2021/business.ledger" and "2021/personal.ledger" files I just "include business-opening-balances.ledger" or "personal-opening-balances.ledger" respectively. That allows me to go back and automatically overwrite those files to adjust my opening balances at any time without having to edit any subsequent transaction. -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/1614004814.116413098%40apps.rackspace.com.
Re: Year end date
In addition to what o1bigtenor suggested I also like to add a little structure to the organization of my ledger files and make heavy use of ledger's include directive (see: https://www.ledger-cli.org/3.0/doc/ledger3.html#Command-Directives). For example, in my top-level directory I create subdirectories for every year, i.e. 2019/, 2020/, 2021/, etc. Also in my top-level directory I create a bunch of ledger files that *only* contain include directives, e.g. 2021.ledger contains just the two lines "include 2021/business.ledger" and "include 2021/personal.ledger"; these are the files I pass to ledger on the command line. Then inside each year-based subdir I create a bunch of files that actually record all of my financial transactions, organized in whatever way makes the most sense (e.g. my "2021/personal.ledger" file also just includes a bunch of files, like "include checking.ledger" and "include mortgage.ledger"). Ok, so how would this help with different tax year end date? Currently, all of my tax years end on December 31, but if I ever had a need to support something else I would just add a new file in my top-level directory such as "2020-tax-year.ledger" that just contains the lines "include 2019/whatever.ledger" and "include 2020/whatever.ledger". And then so I don't forget to add the appropriate --begin and --end command line arguments I would write a wrapper script in my top-level directory such as "tax-year-report.sh". -Original Message- From: "Eric S Fraga" Sent: Monday, February 22, 2021 07:32 To: ledger-cli@googlegroups.com Subject: Re: Year end date On Monday, 22 Feb 2021 at 07:20, o1bigtenor wrote: > May I suggest that you are making life more difficult for yourself and > to the OP there is a simple yet, imo anyway, elegant solution. Thank you. I do use -b and -e as well. -- Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/87v9akqlcu.fsf%40ucl.ac.uk. -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/1614004193.583216506%40apps.rackspace.com.
Summable account balances
How to I produce a list of account balances without sub-accounts being aggregated up the tree? >From this: 2021-01-01 One Assets:One$100 Assets:Cash 2021-01-02 Two Assets:One:Two $50 Assets:Cash I want a report like this: $-150 Assets:Cash $100 Assets:One $50 Assets:One:Two which nicely sums to zero (note the balance of Assets:One). But with --flat --no-total I get this: $-150 Assets:Cash $150 Assets:One $50 Assets:One:Two which doesn't because the balance for Assets:One includes that of Assets:One:Two. Thanks -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/b374d2db-9c4d-4f54-86b1-6126dac7023fn%40googlegroups.com.
Re: Year end date
On Monday, 22 Feb 2021 at 07:20, o1bigtenor wrote: > May I suggest that you are making life more difficult for yourself and > to the OP there is a simple yet, imo anyway, elegant solution. Thank you. I do use -b and -e as well. -- Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/87v9akqlcu.fsf%40ucl.ac.uk.
Re: Year end date
On Mon, Feb 22, 2021 at 6:34 AM Eric S Fraga wrote: > > On Monday, 22 Feb 2021 at 00:59, Dan Sladden wrote: > > Is there a way of specifying the date of the financial year end so I can > > use --yearly (or an appropriate *PERIOD_EXPRESSION)* to show annual data > > for each year from e.g. 6 April to 5 April? > > This would be a nice feature to have! > > My solution has been to have a separate ledger file for each tax year > but that means transferring balances at the end of one year to create > the new year's file which sometimes leads to issues should anything need > to be updated in the previous year's records (missing entry, for > instance). > May I suggest that you are making life more difficult for yourself and to the OP there is a simple yet, imo anyway, elegant solution. This solution was given at least in part, to me here on the forum, and I then modified it to fit my needs. (Can't remember the kind soul who gave me the information originally but huge kudos to them and this list for their helpfulness!!!) ledger reg -f /home/memyself/ledger2014-19.dat --limit 'account =~ /9795\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]/' -b 2014.01.01 -e 2014.12.31 (This is all on one line in your terminal! I tend to use 132 or even wider terminal screens!!) The part that is specific for the OP would be the last two 'commands' (dunno if that's the right word - - - - sorry!). With this you are asking for the search to be performed from the first date of the fiscal year 2014 (the -b command) to the last day of fiscal year 2014 (the e command). I have 10 digit account numbers in a format like xxx.xx.xx.xx so search will give not only all the items that fall within the search (each item with its date) but there is also a sum included (total of all the records!). So for my tax records - - - - account 9795 has a specific meaning and then I enter the total in the tax document. Very very simple - - - - ledger IS your record keeping friend. (I'm working on how to use it for not only accounts receivable and accounts payable but also for invoicing and account aging - - - so far not in practice but have been working on a possible technique. Ledger seriously rocks for business use!!!) HTH -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CAPpdf59e1r6BE0zautwDR2NTA4A75gxbOS3JvXEyGow6J2T2sg%40mail.gmail.com.
Re: Year end date
On Monday, 22 Feb 2021 at 00:59, Dan Sladden wrote: > Is there a way of specifying the date of the financial year end so I can > use --yearly (or an appropriate *PERIOD_EXPRESSION)* to show annual data > for each year from e.g. 6 April to 5 April? This would be a nice feature to have! My solution has been to have a separate ledger file for each tax year but that means transferring balances at the end of one year to create the new year's file which sometimes leads to issues should anything need to be updated in the previous year's records (missing entry, for instance). -- Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/87lfbgs2lv.fsf%40ucl.ac.uk.
Re: Feasability of using ledger an co. for small business accounting automation
Thank you Richard. Starting to learn Emacs has been on my list for a while now, so I guess this is a good chance as any! On Sun, 21 Feb 2021, 07:53 Richard Lawrence, wrote: > Tomás de Almeida writes: > > > I was thinking about doing something very simple and barebones. Akin to > > having job that extracts and parses daily transaction reports from the > > company's bank account into the main ledger data file. > > > > I imagine some of the transactions would be easy to automate as writing > > them into the proper category: repeat customers, periodic fees of > > subscribed services, etc. > > > > The "new" transactions would always be a mistery on which category they > > should be parsed, so they would go into a "to insert manually later" file > > that we would hsve to take a look from time to time. > > I don't have any experience using ledger to manage a business, but I > thought it would be useful to add here that you shouldn't underestimate > the power of a good text editor to help with this automation. > Customizing your editor to help with data entry can save you a lot of > time and effort without taking a human who has all the necessary context > out of the loop. > > For example, I use ledger-mode for Emacs, which provides great features > like completion of account names. I also have various abbrevs setup for > common transactions, so that I can just type e.g. "atm" and get a > transaction filled out for a typical ATM withdrawal, for which I can > then adjust the amount if necessary. I have written custom commands to > automate other things too, like adding the exchange rate on a certain > date. You can go really far with this kind of > mostly-automated-but-human-adjusted data entry. > > Writing custom scripts can be a lot of work (depending on what the > incoming data looks like) and as you note, there will probably be many > cases where more context is needed to categorize something properly. At > least for me personally, it works better to start with editor > customization, and only move to a fully-automated script in cases where > I'm sure I will not need to do any manual review. > > -- > Best, > Richard > -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CABO43G1rUnokPrdZCuaJSLaS%3DFmXe5BTUFVmu6dEGO1vTugVNA%40mail.gmail.com.
Year end date
Is there a way of specifying the date of the financial year end so I can use --yearly (or an appropriate *PERIOD_EXPRESSION)* to show annual data for each year from e.g. 6 April to 5 April? -- --- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/f99e418f-9887-4004-9e73-189efb197b78n%40googlegroups.com.
Re: Matching trades with complex tax rules
I've ended up using the structure described above, effectively manually tracking all the necessary lots, working out the gains at cgtcalculator.com and implementing the results in ledger by hand. It works and there aren't any lots in red because I never use @ or @@ to specify lot prices. Unfortunately that means I also have to manually build a price database. On Monday, 8 February 2021 at 01:56:01 UTC Martin Michlmayr wrote: > * Dan Sladden [2021-02-07 04:59]: > > 2019/03/01 Sell > > Assets:Investments -8 AAA ; @ £15.00 > > This is wrong already. Unfortunately, you'll have to specify the > exact lot; run > ledger bal Assets:Investments --lots > on your example to see the problem -- you shouldn't have any lots > in red. > > Unfortunately, I'm not aware of any way to automate it in ledger > and you'll have to specify the right lots manually. > > -- > Martin Michlmayr > https://www.cyrius.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. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/002150c0-265e-446e-8c7a-c9a7c46fa39cn%40googlegroups.com.