On Sun, Apr 14, 2019 at 7:34 AM Chary Chary <[email protected]> wrote:

>
>
>
>
>>> 2014-02-17 * "Selling some IBM"
>>>  Assets:US:ETrade:IBM                             -3 IBM {160.00 USD} @
>>> 170.00 USD
>>>  Assets:US:ETrade:Cash                              500.05 USD
>>>  Expenses:Financial:Commissions                       9.95 USD
>>>
>>> *Income:GainDueToCommodityPriceChange:realized         -30
>>> USD Income:GainDueToCommodityPriceChange:unrealized        30** USD *
>>>
>>>
>>>
>>>
>>>
>>> Does it make any sense?
>>>
>>
>> There's a lot to read and I have too little time to get deep into the
>> weeds, but I did notice that your transaction above does not balance.
>> Don't forget  that the first posting weights for 3 x 160, not 3 x 170
>>
>> Typically - without your special currency consideration - you would write
>> something like this:
>>
>> 2014-02-17 * "Selling some IBM"
>>  Assets:US:ETrade:IBM                             -3 IBM {160.00 USD} @
>> 170.00 USD
>>  Assets:US:ETrade:Cash                              500.05 USD
>>  Expenses:Financial:Commissions                       9.95 USD
>>  *Income:Gains                                          -30 USD*
>>
>> If I understand what you're trying to do, it is that rather than
>> recognize a 30 USD income, you want to recognize that in EUR, but you want
>> to split the gain into two postings: one for the USD gain, and one for the
>> difference in currency (both in EUR).
>>
>
>
> OK, I see my mistake. In *beancount *model you show gain once you sell
> commodity.  In fact it does say this in your documentation (and I am sure I
> read about this): "*The answer is often surprising to many users: the
> price is not used by the balancing algorithm if there is a cost basis;  the
> cost basis is the number used to balance the postings."*
>
> And in my model gain happens when commodity price goes up. When one sells
> commodity gain only changes from unrealized to realized, but the total
> amount of gain stays the same. I need to think how to work around this
>

FWIW, I played with this idea a while back, converting unrealized to
realized gains:
https://bitbucket.org/blais/beancount/src/default/beancount/plugins/unrealized.py

(I've come to the conclusion that it's so dependent on the various time
periods / reports one generates, that it's best to defer that to reporting
code logic and not reify those realizations as transactions at all.)


Note that you *could* write a plugin that post-processed your transactions
>> and hits the price table to fetch the rates and split up  all those capital
>> gains postings automatically.
>>
>>
> Is there a way to write plugin, which converts all postings to one single
> commodity at a historical price? I am thinking if I could do such
> conversion and then add extra transactions, related to gains due to
> commodity price changes then I could use all logic and reporting of
> beancount to further process it. I guess to achieve this I would need
>
>    - some provision in current design to convert posting to another
>    commodity
>    - preferably function to pull commodity price from price database? Do
>    you have some function like  *get_relative_commodity_price(commodity,
>    referenced_commodity, date))*
>
> I think that's doable (but again, I wouldn't recommend it, if you need
more fancy reporting around gains, I'd implement that in some reporting
code instead).


Once again, this is all driven by idea to have an explanation on how I got
>>> from Day A net Worth to Day B Net Worth.
>>> I must say I still don't understand how people who do trading and spend
>>> and get paid in different currencies live without such report. I just
>>> wouldn't trust calculation, if I can't see how I got from A to B.
>>>
>>
>> People ignore the currency components, and think in terms of their home
>> currency (folding in the change in currency into their P/L).
>>
>>>
>>>
> I understand, that people ignore currency components. But even if you do
> investments in stock you still want to know how you got from A to B, when
> you measure both A and B and B-A in one single currency.
>
>
>
> --
> 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/1921b8af-d39d-4f8e-b5ee-aa706f2b61f5%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/1921b8af-d39d-4f8e-b5ee-aa706f2b61f5%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/CAK21%2BhMwLLP_tmOhCXNC2TQn3fQ%3DiBC4UUtv2NgT6Gi6%3De3Uig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to