Calculating P&L for UK -- or non-US

109 views
Skip to first unread message

Mark Scannell

unread,
Dec 23, 2022, 9:10:13 AM12/23/22
to Beancount
Hello -

I'm looking at adopting Beancount from Ledger CLI. I've been using a Trading Account style of accounting to-date.

The UK doesn't distinguish between purchased lots -- it simply doesn't care -- and, for tax purposes, adopts a dollar-cost-averaging approach with a twist if you sell/buy in short windows. Keeping separate lots doesn't make any sense here.

I'm trying to get my head around if it's even possible -- without too much work -- to adopt Beancount.

I'm thinking of a plugin which -
  • After every sell (which requires a cost basis), it will automatically re-calculate the required split (re-valuation) and adjust the cost basis as appropriate.
  • It can use a straight dollar-cost-average (tax-deferred accounts) or an adjusted dollar-cost-average for normal UK brokerage accounts. (Note -- the adjusted method requires forward looking logic, so future activity can impact the tax calculation.)
Looking through some documentation, it looks like the best thing to do is to treat investments like currencies @ values -- which could then delegate to plugins to calculate capital gains and losses somehow...

Just wondering if anyone has gone down a similar path?

Thanks,
Mark



Martin Michlmayr

unread,
Dec 23, 2022, 9:39:23 AM12/23/22
to bean...@googlegroups.com
* Mark Scannell <mesc...@gmail.com> [2022-12-23 06:10]:
> The UK doesn't distinguish between purchased lots -- *it simply
> doesn't care *-- and, for tax purposes, adopts a
> dollar-cost-averaging approach with a twist if you sell/buy in short
> windows.

So it does care within the first 30 days. ;) Section 104 holding
(i.e. average cost) only applies for those held longer than 30 days.

> I'm trying to get my head around if it's even possible -- without
> too much work -- to adopt Beancount.

Someone was working on average cost support a few years ago, but I
can't remember the outcome. Martin, do you know what happened to
that?

> Looking through some documentation, it looks like the best thing to
> do is to treat investments like currencies @ values -- which could
> then delegate to plugins to calculate capital gains and losses
> somehow...

I wouldn't do that. For example, you lose the info about how many
units you hold. And, as you hint, you lose the built-in capital gains
capabilities.

> Just wondering if anyone has gone down a similar path?

I'm curious what you're doing with ledger and why you are concerned
about moving from ledger to beancount. Beancount can do everything
ledger can do in this regard (and more, such as LIFO and FIFO, even if
that's not useful to you).

--
Martin Michlmayr
https://www.cyrius.com/

Mark Scannell

unread,
Dec 23, 2022, 9:51:13 AM12/23/22
to bean...@googlegroups.com
Martin,

I'm currently using goledger (here) which I've written, maintained, and evolved over the years. I'm looking to move to a larger ecosystem where I can simultaneously add my own flavour of logic while still taking advantage of tools out there. (E.g., Fava, Beancount's VSCode plugin, etc) That and a declining amount of free time to invest in this.

The Trading account approach I've been taking has never worked for calculating capital gains -- current market value, yes, but not capital gains. For trying out Beancount, I've just been mapping the Trading account to Income:Trading to fit the account structure. (Everything else I've done fits into the overall structure, just some tweaks to names..)

It'd be great if I can calculate the realised/unrealised capital gains. I also had a go at calculating an internal rate of return (irr.go) but never managed to integrate it usefully.

Mark


--
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/nW8_thteJbg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/Y6W9lAmBjeTdddxU%40jirafa.cyrius.com.

Martin Blais

unread,
Dec 24, 2022, 4:45:57 AM12/24/22
to bean...@googlegroups.com
On Sat, Dec 24, 2022 at 1:51 AM Mark Scannell <mesc...@gmail.com> wrote:
Martin,

I'm currently using goledger (here) which I've written, maintained, and evolved over the years. I'm looking to move to a larger ecosystem where I can simultaneously add my own flavour of logic while still taking advantage of tools out there. (E.g., Fava, Beancount's VSCode plugin, etc) That and a declining amount of free time to invest in this.

The Trading account approach I've been taking has never worked for calculating capital gains -- current market value, yes, but not capital gains. For trying out Beancount, I've just been mapping the Trading account to Income:Trading to fit the account structure. (Everything else I've done fits into the overall structure, just some tweaks to names..)

With the scheme Beancount isusing for balancing and filling in missing values, you should only need "trading accounts" for cases where there is a currency exchange. 


It'd be great if I can calculate the realised/unrealised capital gains. I also had a go at calculating an internal rate of return (irr.go) but never managed to integrate it usefully.

See beangrow, 
which is an old attempt I made at making this work in the most general way possible.
(It worked.)
You do need to invest time in creating a suitable set of accounts and a corresponding configuration.

 
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 on the web visit https://groups.google.com/d/msgid/beancount/CABV3M2F27OVUKbOxi_0a%2BmUQ0%3D5Gam6VUxnxwEii216HQ7OUEg%40mail.gmail.com.

jaouad zarrabi

unread,
Dec 25, 2022, 11:14:01 PM12/25/22
to Beancount
puy is the world's largest online marketplace for digital products, travel, tickets, eBooks, software, courses, professional services, fashion, electronics, and much more. ipuy allows individuals and businesses to display and sell products online.
We accepte : Paypal -Mastercard - Visa-American Express - Cryptocurrency And more ...........
https://ipuy.com/#a_aid=megastar88&a_bid=377d3948

Martin Blais

unread,
Dec 25, 2022, 11:15:57 PM12/25/22
to Beancount
(Apologies for this I didn't see the top of the email on my cell phone and approved incorrectly.)

Martin Michlmayr

unread,
Dec 26, 2022, 12:48:47 AM12/26/22
to bean...@googlegroups.com
* Mark Scannell <mesc...@gmail.com> [2022-12-23 15:50]:
> It'd be *great* if I can calculate the realised/unrealised capital gains. I
> also had a go at calculating an internal rate of return (irr.go) but never
> managed to integrate it usefully.

BTW, you might find this of interest:

https://github.com/redstreet/fava_investor
https://github.com/hoostus/portfolio-returns/blob/master/irr.py

Although it may not work for you. I'm not exactly sure how you
structure your accounts.
Reply all
Reply to author
Forward
0 new messages