This <https://xuhcc.github.io/beancount-docs/11_how_inventories_work.html#reductions> section of the documentation might help. Specifically: Reductions Augmentations vs. Reductions Homogeneous and Mixed Inventories
Also, read this thread <https://groups.google.com/forum/#!searchin/beancount/redstreet0%7Csort:date/beancount/_DGqjfZ6STg/DOpy3cQfCwAJ>. In short, your sell transaction should look like this: 2020-03-10 * "EUNL sold" Assets:Nordnet:EUNL -20 EUNL {} @ 47.996 EUR Expenses:Financial:Commissions 15 EUR Assets:Nordnet:Cash 944.92 EUR Income:Capital-Gains XXX.XX EUR The {} above might need a lot specification depending on your booking method, and whether you are reducing all positions or some. On Thursday, April 30, 2020 at 8:46:46 AM UTC-7, salmi...@gmail.com wrote: > > I already checked this thread which seemed like a similar problem but I > couldn't apply it to my case: > https://groups.google.com/forum/#!topic/beancount/Qvbcq-Sk5NY > > Anyway, I'm investing to a ETF with ticker EUNL monthly. Recently I sold > some of my position and marked it to my ledger: > 2020-03-10 * "EUNL sold" > Assets:Nordnet:EUNL -20 EUNL @ 47.996 EUR > Expenses:Financial:Commissions 15 EUR > Assets:Nordnet:Cash 944.92 EUR > > > Next time EUNL is mentioned in my ledger is just a random price > definition when I wanted to know my asset worth at certain date: > 2020-03-21 price EUNL 42.536 EUR > > > Today I tried to add a recent purchase of EUNL in a normal way like this: > 2020-04-30 * "EUNL purchase" > Assets:Nordnet:EUNL 8 EUNL {45.9998 EUR} > Assets:Nordnet:Cash -368.00 EUR > > > but I get an error: > No position matches "Posting(account='Assets:Nordnet:EUNL', units=5 EUNL, > cost=CostSpec(number_per=Decimal('45.9998'), number_total=None, > currency='EUR', date=None, label=None, merge=False), price=None, flag=None, > meta={'filename': '/home/tuomas/ledger/ledger.beancount', 'lineno': 5847})" > against balance (-20 EUNL, 80 EUNL {45.10 EUR, 2018-04-30}, 6 EUNL {45.5980 > EUR, 2018-05-07}, 2 EUNL {46.62 EUR, 2018-12-05}, 11 EUNL {46.6660 EUR, > 2018-07-05}, 4 EUNL {46.8219 EUR, 2018-11-05}, 3 EUNL {47.0850 EUR, > 2019-02-05}, 10 EUNL {47.2815 EUR, 2018-06-05}, 10 EUNL {48.5568 EUR, > 2018-08-06}, 4 EUNL {48.6140 EUR, 2019-03-05}, 4 EUNL {49.2354 EUR, > 2018-10-05}, 2 EUNL {49.3720 EUR, 2019-06-05}, 4 EUNL {50.49 EUR, > 2019-04-05}, 3 EUNL {50.5220 EUR, 2019-08-05}, 4 EUNL {50.6877 EUR, > 2019-05-06}, 3 EUNL {52.19 EUR, 2019-07-05}, 4 EUNL {52.436 EUR, > 2019-10-07}, 3 EUNL {52.50 EUR, 2019-09-05}, 7 EUNL {52.9177 EUR, > 2020-03-05}, 5 EUNL {54.5880 EUR, 2019-11-05}, 4 EUNL {55.14 EUR, > 2019-12-05}, 4 EUNL {56.8213 EUR, 2020-01-07}, 3 EUNL {58.5676 EUR, > 2020-02-05}) > > > > If I remove my selling transaction, the problem disappears. Based on the > another thread it looks like this has something to do with how the > Beancount tracks lots. To be honest I'm not completely familiar with that > topic so I didn't figure out yet why my selling transaction breaks things. > So my question is what I'm doing wrong here and how to fix this? > -- 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/43c6a36c-1a7d-4f0f-8cf6-ca26e486ace8%40googlegroups.com.