Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simpler conversion account with --infer-equity #2262

Closed
wants to merge 2 commits into from

Conversation

simonmichael
Copy link
Owner

@simonmichael simonmichael commented Oct 15, 2024

This implements today's proposal on mail list & chat:
[Actually, it never reached the mail list; never mind.]

The --infer-equity flag generates postings to accounts named something like equity:conversion:A-B:A and equity:conversion:A-B:B, where A and B are the commodity symbols being converted between.

I feel these :A-B:* subaccounts

So I think I’d like to drop the subaccounts. —infer-equity would just use equity:conversion (or other conversion account you have designated). Do you see any problems with it ?

This drops the :COMM1-COMM2:COMMN subaccounts, so there's just
a single conversion account, equity:conversion by default.
This reduces noise, and removes complications for `check accounts`
and beancount export.
@simonmichael simonmichael changed the title simpler conversion account simpler conversion account with --infer-equity Oct 15, 2024
@simonmichael simonmichael added A-WISH Some kind of improvement request, hare-brained proposal, or plea. journal The journal file format, and its features. labels Oct 15, 2024
@Xitian9
Copy link
Collaborator

Xitian9 commented Oct 15, 2024

I don't have a strong personal opinion on whether these currency tags should be included, but originally added them because they were requested and the person who requested presented a sufficiently convincing case for why they were beneficial. I can't remember exactly who, and have looked around github for a record. I think it may have been @the-solipsist. Perhaps the conversation occurred in the #hledger chat.

It would be good to dig up the reasons for this so we can weigh them against the benefits of simplification.

@the-solipsist
Copy link
Collaborator

the-solipsist commented Oct 16, 2024

The discussions happened in December 2021:

https://matrix.to/#/!GYlETOAdUBSCcvnEMY:matrix.org/$QOHDt3va8CsIC4X0gIcrzcpr6s2a96drptM6-hDC44I?via=matrix.org&via=mozilla.org&via=envs.net

I prefer COMM1-COMM2:COMM[1/2] because it allows me to use the balance command to find out the gains from a particular investment. E.g., COMM1 might be the INR value I've invested, and COMM2 might be an ISIN for a mutual fund. The balance of the two (when converted into INR with -X₹ with the latest price) gives me the gains.

This technique works across all PTA software, regardless of whether they have functions like --gains built-in or not. Given that, I think it is worth preserving.

I don't think "noise" is a good enough reason to get rid of this. Automated conversion to Beancount is a better reason. Beancount requires all account names to start with a capital Latin letter:

An account name is a colon-separated list of capitalized words which begin with a letter, and whose first word must be one of five account types

So if a commodity starts with a number or a symbol (which none of my commodities do), then a seamless conversion won't work. I'd suggest flagging this to users and allowing them to just use --alias with print to fix the few instances where that might be the case.

Having said that, I won't personally be affected by this change.

@simonmichael
Copy link
Owner Author

simonmichael commented Oct 17, 2024

Thank you both! (And chatters.)

I see that the commodity pair subaccount, at least, that --infer-equity generates, can be quite useful. So I'm going to withdraw this PR.

What then should change about --infer-equity's account names, if anything ? I had two followup questions in chat:

I think most utility comes from the :TRADINGPAIR subaccount; the deeper :TRADINGPAIR:COMM1 and TRADINGPAIR:COMM2 subaccounts are less necessary. They make it easier to precisely report eg "what's the current net cost in USD of my AACO holdings", and see just USD without AACO. Without those leaf accounts, the same report would require cur:USD.

sol agreed with this, though he likes to keep one commodity per leaf account (as I do, usually).

--infer-equity needs a single english-language parent account name to use by default. What is the best choice for this ? I picked "equity:conversion" thinking that was most generic and clear. Would "equity:trade" be more familiar and recognisable in practice ? (trade chosen over trades or trading, for being most generic and spellable)

Currently,

  • equity:conversion is the base account used by --infer-equity
  • When detecting equity conversion postings during transaction balancing, all of the following are recognised: equity:conversion, equity:trade, equity:trades, equity:trading.. in fact any account matching "^equity:(trad(e|ing)|conversion)s?(:|$)"; also any subaccounts of these four.

This is complicated, eg for check accounts. I feel we should probably simplify this to a single default conversion account name. Any other name the user prefers can simply be declared with account type V (Conversion).

sol uses "equity:trading" (plus a bunch of custom subaccounts), but didn't feel strongly. I am currently re-reading the excellent Tutorial on multiple currency accounting (Selinger 2005); he calls them "currency trading accounts".

If starting today I would probably call it equity:trade. But equity:conversion is also fine and it's probably not worth changing unless other related things are changing too. If you care, let me know.

What to do for check accounts ? I suggest the base conversion account (default, or custom declared with type V), and its subaccounts, are allowlisted so check accounts never warns about those. (This relates to a missing feature of account checking: being able to more flexibly ignore undeclared subaccounts, etc.)

What to do for print -O beancount ? It already converts recognised currency symbols to ISO-4217 currency codes. I'd like it to automatically perform the same translation to any account names of the form CONVERSIONACCT:COMM1-COMM2:COMM. Hopefully those can be detected sufficiently robustly.

@simonmichael simonmichael marked this pull request as draft October 17, 2024 06:46
@simonmichael simonmichael added check beancount The beancount output format. labels Oct 17, 2024
@simonmichael
Copy link
Owner Author

Closing this in favour of #2267.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. beancount The beancount output format. check journal The journal file format, and its features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants