Cool, that helped a lot, thanks! Best, Matthias
Am Samstag, 18. November 2023, 15:44:30 CET schrieb Martin Blais: > Check out the section on trading in the docs. > You can choose a booking method, e.g. FIFO, or do it manually (if you use > the "specific lot identification" method). > One trick that works well when doing by is to run bean-doctor to get the > context around a transaction, it gives you the contents of the account just > before the transaction with the individual lots and you can just select the > ones you want to reduce and copy-paste them. > If you specify a booking method it does it for you; you can use bean-doctor > context to view the selected lots in the same way. > Hope this helps, > > > > > On Sat, Nov 18, 2023 at 3:44 AM Matthias Beyer <m...@beyermatthias.de> > > wrote: > > Hi Blais, > > Hi beancount list, > > > > I am a long term beancount user but only lately got into how to work with > > beancount and stock trading. > > > > I moved my stock trades from "normal syntax", like: > > > > 2023-11-18 * "Buy some" > > > > Assets:Stock +10 COOLSTOCK @ 10 EUR > > Assets:Bank:Account -105 EUR > > Expenses:Commissions > > > > to the appropriate one > > > > 2023-11-18 * "Buy some" > > > > Assets:Stock +10 COOLSTOCK {10 EUR} > > Assets:Bank:Account -105 EUR > > Expenses:Commissions > > > > because I just recently learned about how to actually use beancount for > > stock > > trading. > > > > Now, my issue is that I buy ETF for a rather long time now, recurringly > > (each > > months 1st). That means that there are a lot of postings for ETFs. I know > > about the (experimental) "recurring" plugin, but I assume that this won't > > work > > here because of the everchanging prices. > > Either way, I wouldn't actually use that plugin, because I auto-import > > transactions from my bank account and would need to filter out > > transactions > > that are already done by a recurring order. > > > > But that aside, my question is about something different actually: Do I > > move my > > ETF postings from the first syntax (from above) to the second? It is not > > that > > this is quite some effort (vim scripting ftw) but rather that it becomes > > quite > > complex once I sell ETF again, right? Because I would essentially "match" > > my > > ETF against the buying orders, although I probably do not sell the exact > > same > > amount that I bought order-by-order! > > > > E.G. > > > > * buy 100 EUR worth of ETF at 10 > > * buy 100 EUR worth of ETF at 11 > > * buy 100 EUR worth of ETF at 12 > > * buy 100 EUR worth of ETF at 13 > > * buy 100 EUR worth of ETF at 14 > > * buy 100 EUR worth of ETF at 15 > > * buy 100 EUR worth of ETF at 16 > > ... years pass > > Now I have to sell. ETF is at 50 now and I want to have 100 out of it > > every > > transaction. > > So what I do now is > > * sell 100 EUR worth of ETF that I bought at 10 > > > > The first 5 transactions of this work perfectly well... because the amount > > I > > bought at 10 is now worth 500 of my currency. But after that I have to > > sell > > <some fraction> of what I bought at 11 to get out 100 and for the last bit > > of > > what I bought at 11 I also have to sell some fraction of what I bought at > > 12 > > to get out 100 of my currency. And this gets even more complex in > > real-life > > because the ETF of course does not stay at 50 during my time that I am > > selling, but is still moving in price and also because/if I do not want to > > get > > out 100 but, say, 550 of my currency... > > > > Does my logic check out? > > > > Is there any "simple" solution to that? I can totally see the benefit of > > actually doing that calculation! It's just that I am looking for a less > > complex alternative to not burden my future self with work that might be > > unnecessary! :-) > > > > I am really looking forward to your answer! > > Thank you very much for beancount! > > Have a great weekend, > > best from Germany > > Matthias -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/22084491.EfDdHjke4D%40takeshi.
signature.asc
Description: This is a digitally signed message part.