Martin,

thanks for the feedback. I guess this is a   trading accounts method, based 
on the Peter Selinger 
<https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html>'s document.

But how would you approach the situation, when there is no exchange at all.

======================

option "operating_currency" "BBB" 

2020-01-01 open Assets:Bank
2020-01-01 open Equity:Opening-Balances

2020-01-01 price AAA 1.0 BBB

2020-01-01 * "Opening Balance"
    Assets:Bank                100 AAA
    Equity:Opening-Balances   -100 AAA

; Note: at this moment out net worth, when measured in BBB, is 100 BBB, as 
the exchange rate is 1.0

2020-02-01 price AAA 2.0 BBB

; Note: at this moment out net worth, when measured in BBB, is 200 BBB, as 
the exchange rate has changed

=======================

The *sing_curr_conv *solves this like this

2020-01-01 open Assets:Bank 2020-01-01 open Equity:Opening-Balances 
2020-01-01 price AAA 1.0 BBB 2020-01-01 * "Opening Balance" Assets:Bank 
100.0 BBB scc_msg: "Converted from 100 AAA" Equity:Opening-Balances -100.0 
BBB scc_msg: "Converted from -100 AAA" 2020-02-01 open 
Income:Unrealized-Gains:BBB-AAA 
2020-02-01 price AAA 2.0 BBB 2020-02-01 * "Unrealized gains due to AAA 
price change from 1.0 to 2.0 BBB (BBB price change from 1 to 0.5 AAA)" 
scc_msg: "Created by the Single Currency Converter" Assets:Bank 100.0 BBB 
scc_msg: "Calculated on the balance of 100 AAA at the beginning of this day 
(end of prev. day)" scc_at_cost: "no_cost" scc_unreal_g_cause: 
"price_change" Income:Unrealized-Gains:BBB-AAA -100.0 BBB scc_msg: "Calculated 
on the balance of 100 AAA at the beginning of this day (end of prev. day)" 
scc_at_cost: "no_cost" scc_unreal_g_cause: "price_change" scc_bal_s_acc: 
"Assets:Bank" 

I guess, the method I implemented is what is described as  The "official" 
solution: translation to a single currency 
<https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html#3.2> in the 
Peter 
Selinger <https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html>'s 
document.

Regards.

On Thursday, January 16, 2025 at 3:24:02 PM UTC+1 bl...@furius.ca wrote:

> I wouldn't do it like that.
>
> I think it's quite strange to convert AAA to BBB units in BankA and I 
> wouldn't do that.
>
>
> This:
>
> 2020-02-01 * "Exchange AAA to BBB"    Assets:BankA               -100.0 AAA   
>  Assets:BankB                150.0 BBB @@ 100 AAA ; <== price, different from 
> the one in the price directive
>
> Instead of this:
>
>
> 2020-02-01 * "Exchange AAA to BBB"
>   Assets:BankA                                            -100.0 BBB
>   Assets:BankB                                               150 BBB
>   Income:Unrealized-Gains:BBB-AAA  -50.0000000000000000000000000 BBB
>
>
> Would instead be converted to
>
>
> 2020-02-01 * "Exchange AAA to BBB"  Assets:BankA                              
>               -100.0 AAA
>   Assets:BankB                                               150 BBB
>
>   Expenses:CurrencyAccounts:AAA                                  100.0 AAA  
> Expenses:CurrencyAccounts:BBB                                 -150 BBB
>
>
>
> On Mon, Jan 13, 2025 at 9:35 AM Chary Ev2geny <char...@gmail.com> wrote:
>
>> Martin,
>>
>> thanks!
>>
>>
>> We did have several discussions with you on this idea of mine (e.g. here 
>> <https://groups.google.com/g/beancount/c/CIhT0jrlqI4/m/odxwtnK-BQAJ>). 
>>
>> I also know that you were working on the unrealized gains as well.
>>
>> I remember you had had an unrealized gain plugin, plus in v3 I think 
>> there were plans for trading accounts based on the Peter Selinger 
>> <https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html>'s 
>> document.
>>
>> I will really appreciate you could spend 5 min time to review how I 
>> implemented the idea. 
>>
>> It is best shown in this Jupiter notebook:
>>
>>  how_sing_curr_conv_works.ipynb 
>> <https://github.com/Ev2geny/evbeantools/blob/main/docs/how_sing_curr_conv_works.ipynb>
>>  
>>
>> For me it does exactly what I need so far, but I wonder if you can see 
>> any flaws there or have any comments.
>>
>> On Monday, January 13, 2025 at 12:55:34 PM UTC+1 bl...@furius.ca wrote:
>>
>>> Thanks for sharing! Added to the contribs list.
>>>
>>>
>>> On Mon, Jan 13, 2025 at 3:08 AM Chary Ev2geny <char...@gmail.com> wrote:
>>>
>>>> Dear all I would like to a announce a sing_curr_conv: Neth Worth Change 
>>>> explainer / Unrealized Gains analyzer
>>>>
>>>> This tool makes it possible to explain changes in the Net Worth between 
>>>> any two dates in a situation of multi-currency / multi-commodity ledger 
>>>> with changing exchange rates and transfers of funds from one commodity to 
>>>> another (both cost and not cost-based tracked). This is achieved by 
>>>> creating a converted / equivalent ledger, on which further analysis can be 
>>>> done using beanquery <https://github.com/beancount/beanquery>.
>>>>
>>>> The tool can be used
>>>>
>>>>    - 
>>>>    
>>>>    from a command line
>>>>    - 
>>>>    
>>>>    as a function in Python code
>>>>    - 
>>>>    
>>>>    as a plugin
>>>>    
>>>>
>>>> I may be wrong, but I think there is no generic solution for the Net 
>>>> Worth Change problem in the beancount community (e.g. see this 
>>>> <https://groups.google.com/g/beancount/c/MQQZ24tTgWE/m/a-9BXEfbAAAJ>
>>>> discussion).
>>>>
>>>> The accompanying Jupyter notebook sing_curr_conv_usage.ipynb 
>>>> <https://github.com/Ev2geny/evbeantools/blob/main/docs/sing_curr_conv_usage.ipynb>
>>>>  
>>>> has detailed example of how the sing_curr_conv can be used in practice.
>>>>
>>>> The sing_curr_conv is a part of the evbeantools package, which can be 
>>>> found here
>>>>
>>>> https://github.com/Ev2geny/evbeantools
>>>>
>>>> I must say, the sing_curr_conv is a result of quite a long activity, 
>>>> and actually the very reason I came to beancount 6 years 
>>>> <https://groups.google.com/g/beancount/c/CIhT0jrlqI4/m/SEtok-T0CAAJ> 
>>>> ago and one of the reasons I learned python. With this in mind and taken 
>>>> into account, that I am not a professional developer, any feedback is more 
>>>> than welcome (including, but not limiting the feedback on the code, style, 
>>>> project etc). 
>>>>
>>>> -- 
>>>> 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+...@googlegroups.com.
>>>> To view this discussion visit 
>>>> https://groups.google.com/d/msgid/beancount/77d5fe9f-19ba-4664-a65d-8ca6d272f331n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/beancount/77d5fe9f-19ba-4664-a65d-8ca6d272f331n%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+...@googlegroups.com.
>>
> To view this discussion visit 
>> https://groups.google.com/d/msgid/beancount/4d209d3a-6188-4d59-931f-97aa5e5f1739n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/beancount/4d209d3a-6188-4d59-931f-97aa5e5f1739n%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 visit 
https://groups.google.com/d/msgid/beancount/5633eeed-6105-4171-8939-58b62b3c3700n%40googlegroups.com.

Reply via email to