Setting aside beancount for a second, a) what cost currency was the commodity held in? I.e., what currency was it purchased and sold against? b) it seems like a good way to think about this sale is two transactions: a sale of S_SQ, and a subsequent currency conversion. Do you think that's a good model? If so, I'd recommend starting by splitting it into those two transactions in your ledger, which should lead to clarity.
On Saturday, May 1, 2021 at 1:59:37 PM UTC-7 [email protected] wrote: > I think I now understand what's going on here. > > It's actually simple: because the commodity is priced in USD, Beancount is > naturally calculating my profit in USD. > The result is 1338.43 USD – which, at the current exchange rate on the > sale date, is 1015.35 GBP. > > But because I actually made the transactions in GBP, and the exchange rate > has changed in the meantime, my actual profit is different (977.88 GBP). > > I'm not sure what the cleanest way is to resolve this. At present I can > think of two options: > > 1. Use a 'false' FX rate for the profit/loss leg of the transaction, such > as by using Beancount's @@ syntax. > Example: > Income:Investments:PnL -977.88 GBP @@ 1338.43 USD > At first glance this seems quite elegant, but one disadvantage is that it > will result in incorrect entries in the prices database for GBP/USD. > > 2. Add another leg for FX gains/losses (I'm not sure if Expenses is the > right category) > Example: > Income:Investments:PnL -977.88 GBP @ 1.31820 USD > Expenses:Financial:FXGainLoss -37.46 GBP @ 1.31820 USD > The problem with this is that it looks like I made a profit on the FX > difference, when I actually made a loss. I'm not sure how to resolve that. > > Does anyone have any better ideas? > > > On Sat, 1 May 2021 at 20:54, Caesar Schinas <[email protected]> > wrote: > >> Apologies, I made a minor error in my last message – my arithmetic >> doesn't add up because I omitted to account for the FX fee of 6.60 GBP. >> The point remains: the much larger 'error' of 49.38 GBP is unaccounted >> for. >> >> On Saturday, 1 May 2021 at 20:46:45 UTC+1 Caesar Schinas wrote: >> >>> But that's the thing: my income *wasn't* 1015.34 GBP, it was 977.88 GBP. >>> That is the difference between the amount of 482.60 GBP that was debited >>> from my account when I bought the shares, and the amount of 1467.08 GBP >>> that was credited to my account when I sold the shares. >>> >>> So something else is amiss. But I can't work out what. (Unless it's >>> totally incorrect exchange rates from my broker. But their web interface >>> shows the same figures as the CSV from which I extracted the above data, >>> and I'm loath to 'massage' the rates just to make the numbers fit, without >>> actually understanding what's wrong.) >>> >>> >>> On Saturday, 1 May 2021 at 20:18:53 UTC+1 [email protected] wrote: >>> >>>> Sale 11 175.81 1,933.91 >>>> Cost 11 54.135 595.49 >>>> 1,338.43 >>>> >>>> Proceeds 1467.08 1.3182 1,933.90 >>>> PnL (1,015.34) 1.3182 (1,338.43) >>>> 595.48 >>>> >>>> So you should have -1015.34 GBP as your Income, not -977.88 >>>> >>>> Of course, you would need an additional posting to absorb rounding >>>> errors. >>>> >>>> On Wednesday, April 28, 2021 at 5:14:40 PM UTC-7 >>>> [email protected] wrote: >>>> >>>>> I've been using beancount for a while for my everyday transactions, >>>>> but am only recently getting around to trying to import my trading >>>>> activity >>>>> to my ledger as it seems much more complex. >>>>> >>>>> I'm having trouble with accounting for profit/loss on shares which are >>>>> priced in a currency different to the main currency of my trading account. >>>>> >>>>> My trading account is in GBP, but I often buy shares priced in USD. My >>>>> broker handles the conversion, and charges me an FX fee as a percentage >>>>> of >>>>> the value of the trade. >>>>> >>>>> Here is an example: >>>>> >>>>> 2020-03-31 * "Buy 11 shares of Square" >>>>> Assets:GB:Freetrade:GIA:Cash -482.60 GBP @ 1.23390 USD >>>>> Assets:GB:Freetrade:GIA:SQ 11 S_SQ {54.13456 USD} >>>>> >>>>> ; ... >>>>> >>>>> 2020-11-16 * "Sell 11 shares of Square" >>>>> Assets:GB:Freetrade:GIA:Cash 1467.08 GBP @ 1.31820 USD >>>>> Assets:GB:Freetrade:GIA:SQ -11 S_SQ {54.13456 USD} @ >>>>> 175.81000 USD >>>>> Assets:GB:Freetrade:GIA:Cash -6.60 GBP >>>>> Expenses:Financial:Fees 6.60 GBP >>>>> Income:Investments:PnL -977.88 GBP @ 1.31820 USD >>>>> >>>>> All the figures are from my broker's reports, except for the profit >>>>> calculation. >>>>> For the profit I have simply subtracted the GBP purchase price from >>>>> the GBP sale price, as this is the actual amount of profit I made (the >>>>> actual net change in my account balance). >>>>> >>>>> However, the second transaction does not balance: >>>>> Transaction does not balance: (49.3832800 USD) >>>>> >>>>> I am struggling to understand where the extra 49.3832800 USD came >>>>> from (or went?), or how I can balance this transaction. >>>>> >>>>> I'm quite new to this. Can anyone give me any tips? >>>>> >>>> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Beancount" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/beancount/3Bp4ZgnqOvY/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beancount/20b40ee8-50cd-436b-b402-e5e22e6ede11n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beancount/20b40ee8-50cd-436b-b402-e5e22e6ede11n%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/f0c5845b-793b-440f-be43-ca858d30256en%40googlegroups.com.
