Theoretically that can happen but in practice I don't think it happens. And even if it does the effect is not noticeable in practice
My personal accounts that I have represented in beancount are probably close to the worst case scenario of real-life transitivity... I have income in GBP, I earn in CNY. I have some investment accounts in GBP with GBP investments and some investment accounts in USD with mixed investments. Through the history of adding new transactions, no flip flops happen (except maybe after just the initial txs) because of the trick of weighting the graph distances by 1/txs.size. So the more transactions happen, the more "obvious" the shortest path becomes. In any case, I take it you're busy with non-beancount things these days so this might be academic for you. If there is interest, I can share more with those looking to implement Kevin p.s. The whole thing becomes somewhat moot if I inject daily historic FX prices into my accounts so almost everything goes through USD at that point. On Wednesday, 11 March 2020 22:07:43 UTC+8, Martin Blais wrote: > > That's a nice idea, but one problem is that if the number of transactions > flip-flops the path in the graph after inserting new ones, you will > experience potentially confusing differences in your reporting. The user > has to be aware of this. > > On Wed, Mar 11, 2020 at 2:23 AM <glo...@gmail.com <javascript:>> wrote: > >> I was also looking for strong cross-currency support for my accounts >> where prices do get very transitive... I ended up writing my own code to do >> this. The algorithm is as follows >> >> 1) Examine all cross-currency transactions to find all conversion >> "vertices" of a graph >> 2) Find the shortest distance (Dijkstra's algorithm) from the desired >> reporting currency to every other currency using a node distance of 1/n >> where n is the number of transactions between those two commodities >> 3) Convert the price of all non-reporting currencies to the reporting >> currency by converting along that path. Intermediate conversion use an >> interpolation algorithm for non-matching dates (I just chose linear) >> >> The result of this one off computation is a single CCY->USD type map that >> can be used for all remaining reporting just like before and have the same >> performance >> >> Hope this idea is of use! >> >> Regards, >> >> >> On Sunday, 13 October 2019 11:07:08 UTC+8, Martin Blais wrote: >>> >>> It does not, it's intended, and going down that route will lead you down >>> a rabbit hole. See previous chat on mailing lists. >>> >>> On Sat, Oct 12, 2019, 18:26 <m.re...@gmail.com> wrote: >>> >>>> I ran the query >>>> >>>> bean-query data/main.bean "SELECT account, sum(convert(position, >>>> 'CHF')) WHERE account ~ 'Assets' group by account" >>>> >>>> and I have in my ledger some entries in, say, GOLD and EUR. >>>> I also have a price datapoint for GOLD in EUR, and for EUR in CHF, at >>>> the same date. >>>> >>>> The result is that the assets in EUR are converted to CHF, but the ones >>>> in GOLD are left in GOLD. >>>> >>>> So unless I am mistaken, it would seem that beancount does not >>>> "combine" prices to get more conversions. Is that true? If so, is that >>>> intended? Would it make sense to try and write a plugin for this? >>>> >>>> Thanks >>>> >>>> M. >>>> >>>> -- >>>> 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 bean...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/beancount/b053a42b-44a9-44b0-abe3-fb85adb541b2%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/beancount/b053a42b-44a9-44b0-abe3-fb85adb541b2%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> 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 bean...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beancount/fb6b97ad-3857-48ab-8741-8951043e5a96%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beancount/fb6b97ad-3857-48ab-8741-8951043e5a96%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 beancount+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/c658ab8b-55d9-4ec4-8829-0af5e16aa873%40googlegroups.com.