Hi Patrick, in order to compute PnL, you need to provide cost instead of price:
2017-06-01 * "Buy USD"
Assets:CHF -30 CHF
Assets:USD 20 USD { 1.5 CHF }
2017-07-01 price USD 1.7 CHF
2017-08-01 * "Sell USD"
Assets:USD -20 USD { 1.5 CHF } @ 2 CHF
Assets:CHF 40 CHF
Income:PnL
This way you could see a realized PnL of (2 CHF - 1.5 CHF) * 10 = 5 CHF
in the account Income:PnL.
To compute unrealized PnL, you could enable a built-in plugin:
plugin "beancount.plugins.unrealized" "Unrealized"
This way you could see an unrealized PnL in Assets:CHF:Unrealized.
See official documentation for more information:
https://docs.google.com/document/d/1WjARst_cSxNE-Lq6JnJ5CC41T3WndEsiMw4d46r2694/edit
2017-09-18 11:14:22 patrick via Beancount <[email protected]>:
> Hi,
>
> I've now tried to search for this for quite a bit but somehow I'm not finding
> the right stuff or maybe not
> understanding it right and I hope someone can help me.
>
> I would like to separate the currency gains from other income and would like
> to also differentiate between realized and
> unrealized gain.
>
> Let's take the following example
>
> 2017-06-01 * "Buy USD"
> Assets:CHF -30 CHF
> Assets:USD 20 USD @ 1.5 CHF
>
> 2017-07-01 price USD 1.7 CHF
>
> 2017-08-01 * "Sell USD"
> Assets:USD -20 USD @ 2 CHF
> Assets:CHF 40 CHF
>
>
> • On 2017-07-01 I would have an unrealized currency gain of 4 CHF, how
> would I see this?
> • On 2017-08-02 I would have a realized currency gain of 10 CHF, how would
> I set this up to see this as income?
>
>
> One thing I found was
> http://www.mathstat.dal.ca/~selinger/accounting/tutorial.html
>
> Which looked quite interesting to me and seems to have a solution for this
> but I'm struggling with implementing some of
> the details of it.
> I think in my case the concept of "adjusted cost base" seems to be the
> simplest and make sense.
>
> So if I understood that correct I would need to do the following:
>
> 2017-06-01 *
> Assets:CHF -30 CHF
> Income:USDTrading 30 CHF
> Income:USDTrading -20 USD
> Assets:USD 20 USD
>
> 2017-07-01 price BTC 0.30 CHF
>
> 2017-08-01 *
> Assets:USD -20 USD
> Income:USDTrading 20 USD
> Income:USDTrading -30 CHF
> Income:USDTradingRealized -10 CHF
> Assets:CHF 40 CHF
>
> What I get out of this
>
> • If I take the balance of Income:USDTradingRealized with the current
> exchange rate this should reflect my unrealized
> gain
>
>
> A couple of things that confuse me
>
> • This feels somehow "wrong" as I'm no longer using the @ price annotation
> and have this price implicit in the
> difference between the amounts in one currency going into the USDTrading
> and and out of the USDTrading in the other
> currency.
> • I need to manually calculate the -10 CHF realized gain
> • Income:USDTradingRealized could actually be an income or an expense,
> depending on current exchange rates
>
>
> Can anyone help me with this or point me in the right direction?
>
>
> Thanks and Regards,
> Patrick
>
>
>
> --
> 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/
> 397c15c6-c5ea-4d9c-917f-60adf03344d4%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Zhuoyun Wei
--
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/20170919071516.GA20960%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: PGP signature
