On Sun, May 02, 2021 at 06:45:40PM +0100, Caesar Schinas wrote:
> 
> 
> > On 2 May 2021, at 17:35, James Cook <[email protected]> wrote:
> > 
> >> I’ve played with manually “converting” the currencies using “currency 
> >> accounts” as described at 
> >> https://beancount.github.io/docs/beancount_v3.html#currency-accounts-instead-of-a-single-conversion
> >>  
> >> <https://beancount.github.io/docs/beancount_v3.html#currency-accounts-instead-of-a-single-conversion>,
> >>  but so far I haven’t managed to convert that currency loss to an actual 
> >> loss instead of having it show up as a gain (negative expense or income 
> >> value).
> > 
> > Can you show an example?
> 
> Hmm, well here’s what I’ve got so far… 
> The `Equity:Exchange` entries are redundant except to be more specific about 
> what’s going on, and could functionally be dropped if the commented exchange 
> rates were uncommented.
> Functionally the only change from where I started is the `Equity:FXGainLoss` 
> entry.
> 
> option "inferred_tolerance_default" "GBP:0.005"
> option "inferred_tolerance_default" "USD:0.005"
> plugin "beancount.plugins.auto_accounts"
> 
> 2020-03-31 * "Buy 11 shares of Square"
>   Assets:GB:Freetrade:GIA:Cash      -482.60 GBP ;@ 1.23390 USD
>   Equity:Exchange:GBP                482.60 GBP
>   Equity:Exchange:USD               -595.48 USD
>   Assets:GB:Freetrade:GIA:SQ             11 S_SQ {54.13456 USD}
> 
> 2020-11-16 * "Sell 11 shares of Square"
>   Assets:GB:Freetrade:GIA:SQ            -11 S_SQ {54.13456 USD} @ 175.81000 
> USD
>   Equity:Exchange:USD               1933.91 USD
>   Equity:Exchange:GBP              -1467.08 GBP
>   Assets:GB:Freetrade:GIA:Cash      1467.08 GBP ;@ 1.31820 USD
>   Income:Investments:PnL            -977.88 GBP @ 1.31820 USD
>   Equity:FXGainLoss                  -37.47 GBP @ 1.31820 USD
> 
> 
> Note that I haven’t yet managed to drop the @ exchange rates on the last two 
> postings, even with the `Equity:Exchange` accounts.
> And I haven’t really decided if `Equity` is the right place for that 
> `FXGainLoss` account, but it certainly doesn’t make sense to me anywhere else 
> or it appears to one a profit, when in fact it’s a loss (albeit a loss which 
> is already accounted for in the posting to `Income:Investments:PnL`, so all 
> I’m really trying to do is ‘discard’ it to make the entry balance…)
> 

I don't think I completely understand what you're doing. E.g. I'm not
sure where 977.88 GBP comes from.

I'm certainly no expert, but how I would account for this depends on
which country I'm doing my taxes for. (My plugin tries to do both at
once, at the cost of some added complexity.)

For the US, (I think) my PnL should be computed just using the USD
amounts. So it should come out to (175.81-54.13456)*11 = 1338.43 USD.
Here's a way to get that:

option "operating_currency" "GBP"
option "inferred_tolerance_default" "GBP:0.005"
option "inferred_tolerance_default" "USD:0.005"
plugin "beancount.plugins.auto_accounts"

2020-03-31 * "Buy 11 shares of Square"
  Assets:GB:Freetrade:GIA:Cash      -482.60 GBP
  Equity:Exchange:GBP                482.60 GBP
  Equity:Exchange:USD               -595.48 USD
  Assets:GB:Freetrade:GIA:SQ             11 S_SQ {54.13456 USD}

2020-11-16 * "Sell 11 shares of Square"
  Assets:GB:Freetrade:GIA:SQ            -11 S_SQ {54.13456 USD} @ 175.81000 USD
  Equity:Exchange:USD               1933.91 USD
  Equity:Exchange:GBP              -1467.08 GBP
  Assets:GB:Freetrade:GIA:Cash      1467.08 GBP
  Income:Investments:PnL           -1338.43 USD

The only changes from your example were to drop the Equity:FXGainLoss
posting, and change the Income:Investments:PnL posting to USD.

If you want to do taxes in GBP: well, you put in 482.60 GBP and got
back 1467.08 GBP, so your profit is 984.48 GBP. Here's how you can get
that:

option "operating_currency" "GBP"
option "inferred_tolerance_default" "GBP:0.005"
option "inferred_tolerance_default" "USD:0.005"
plugin "beancount.plugins.auto_accounts"

2020-03-31 * "Buy 11 shares of Square"
  Assets:GB:Freetrade:GIA:Cash      -482.60 GBP
  Assets:GB:Freetrade:GIA:SQ             11 S_SQ {43.8727 GBP}

2020-11-16 * "Sell 11 shares of Square"
  Assets:GB:Freetrade:GIA:SQ            -11 S_SQ {43.8727 GBP} @ 133.3713 GBP
  Assets:GB:Freetrade:GIA:Cash      1467.08 GBP
  Income:Investments:PnL            -984.48 GBP

I simply removed all mention of USD.

Neither of my examples include an "FXGainLoss" account. If you want to
include it, I think you will need to start be definining exactly what
it's supposed to measure. Personally I don't see why it's needed.

-- 
James

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20210507175122.6gmdsgydl664cmul%40moth.falsifian.org.

Reply via email to