Ok, thanks. I will have to do some more reading to be able to fully understand your answer
On Sunday, March 3, 2019 at 11:12:57 PM UTC+1, Martin Blais wrote: > > On Sun, Mar 3, 2019 at 5:03 PM Chary Chary <[email protected] > <javascript:>> wrote: > >> Martin, >> >> just for my understanding. >> >> *Q1)* Why did you have to implement the *currency_accounts plugin* if >> you already have *beancount.plugins.unrealized* >> >> Isn't the latter supposed to do exactly what I asked for in my starting >> topic? >> > > Because profits generated as a result of assert appreciate (above cost > basis), within their denominated currency, are distinct from (usually > accidental) profits generated from divergence of the investment's currency > over the user's home currency. > > > In the description, of the *beancount.plugins.unrealized *you write that >> >> *This will create a synthetic transaction at the date of the last of >> directives, that reflects the unrealized P/L. * >> > > Yes. > > In terms of reporting, it's also the wrong thing to do... it was > implemented as a quick experiment to see if this could be used to include > unrealized profits on the balance sheet. > Turns out it sort-of works, but the transactions that should be inserted > depend on the reporting period, so really, it's a function of the reporting > parameters. > Don't use it. > The right thing to do is for the reporting code to calculate the produce > the unrealized gain/loss at the time (usually end of period) of reporting. > > > > This was my understanding of exactly how Peter Selinger method >> <https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html> is >> supposed to work >> > > The Selinger doc explains one method for dealing with accidental profits > due to holding a portfolio of currencies without a cost basis. > Not handling gains/losses in investments. > These are two very different things and should be treated distinctly. > > It's a long and complicated topic, but in short: > - Treat your investmnets in their local currency, tracking their original > cost basis in their home currency > - If you want to track profits due to currency movements, in general, use > the Selinger method (with or without my plugin) > > > *Q2) *You write >> <https://docs.google.com/document/d/1WjARst_cSxNE-Lq6JnJ5CC41T3WndEsiMw4d46r2694/edit#> >> that >> >> *"beancount.plugins.unrealized" "Unrealized" will create a synthetic >> transaction at the date of the last of directives, that reflects the >> unrealized P/L. It books one side as Income and the other side as a change >> in Asset.* >> >> Is my understanding correct, that this will be a virtual transaction, >> kept only in memory and not to be seen in a text format anywhere? >> > > Yes. > But don't use that plugin. > Use a report rendering thing like Fava instead, which should be render add > unrealized gains for you, depending on the reporting period you seek to > view. > > > > > On Thursday, February 28, 2019 at 5:45:58 AM UTC+1, Martin Blais wrote: >>> >>> Here, I finally did implemented a prototype: >>> >>> https://bitbucket.org/blais/beancount/commits/ecf5229f65fd574676cd47a060cfbe22152d12fb >>> I guess it took me two hours. >>> >>> It's not entirely trivial; there are a few issues that keep this at the >>> level of "prototype": >>> >>> 1. the price annotations get stripped out, which means that if you used >>> the implicit_prices plugin AFTER this one, your prices might disappear. >>> Other plugins, such as sellgains, would also have to run BEFORE this one in >>> order to take effect. Custom scripts also would not see price annotations. >>> This could be fixed by changing the booking code to ignore the price >>> annotation for modified postings (identified via flag of the presence of >>> metadata). In other words, instead of removing the price annotations, keep >>> them but make them "lame" by inserting some metadata and requiring >>> collaboration with the booking code (it's a little bit ugly, but I'd be >>> okay with it). >>> >>> 2. In some cases - a transaction with multiple currency groups, at least >>> one price annotation, and some non-zero residual - a currency trading >>> account posting will be inserted in lieu of a residual posting. This messes >>> with the rounding feature that automatically inserts postings for residuals >>> (maybe it's not that big a deal). I think it could be improved further by >>> conditioning the insertion on multiple required currency account postings. >>> >>> For more about these limitations, see the test file (look for FIXME). >>> >>> I like this plugin. There's no need to change any of your input to use >>> it (it worked on my ledger without modification). Maybe I should finesse it >>> and this could become there by default in a future version. It works on my >>> personal large input file and does adds only an insignificant amount of >>> overhead. This is the most natural way to deal with conversions. >>> >>> See this file for usage instructions: >>> >>> https://bitbucket.org/blais/beancount/src/default/beancount/plugins/currency_accounts.py >>> >>> >>> On Wed, Feb 27, 2019 at 9:17 PM Martin Blais <[email protected]> wrote: >>> >>>> I believe it's absent. >>>> In Beancount, what would be required is basically to sum up the >>>> balances of each currency group and insert new accounts. >>>> It's not difficult, though it's not cheap, some optimizations might be >>>> required. >>>> >>>> >>>> >>>> >>>> >>>> >>>> On Wed, Feb 27, 2019 at 9:14 PM Callum Makkai <[email protected]> >>>> wrote: >>>> >>>>> >>>>> On 2/27/19 9:10 PM, Martin Blais wrote: >>>>> >>>>> An elegant way to handle this is to use the Selinger trading accounts >>>>> method. >>>>> It would be easy to write a Beancount plugin to do this automatically. >>>>> >>>>> >>>>> Jumping in here ... Martin, I was reading about the Selinger method >>>>> the other day. Do you know if ledger or hledger implements this method? >>>>> Or >>>>> it's totally absent from all plain text packages? >>>>> >>>>> Callum >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Beancount" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/beancount/73b3eb60-39b3-3d64-37e4-0b82543fe40e%40gmail.com >>>>> >>>>> <https://groups.google.com/d/msgid/beancount/73b3eb60-39b3-3d64-37e4-0b82543fe40e%40gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >> You received this message because you are subscribed to the Google Groups >> "Beancount" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beancount/33ac0b66-aa2f-4a5f-924a-a1aaa0ca5b6f%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beancount/33ac0b66-aa2f-4a5f-924a-a1aaa0ca5b6f%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/939fe47e-382a-4272-94e6-dd29f660d519%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
