Brian Lalor wrote: > I know this has been discussed a few times, but the docs are still incorrect > and I’m unable to find a complete example. I’m using beancount v2 because > Fava’s not been updated for v3, yet. > > NVDA recently split 10:1. I previously purchased 2 shares: > > option "operating_currency" "USD" > > 2024-02-14 open Equity:Opening-Balances > USD > > 2024-02-14 open Assets:Cash > USD > 2024-02-14 pad Assets:Cash Equity:Opening-Balances > > 2024-02-14 open Assets:Stocks:NVDA > NVDA > 2024-02-14 commodity NVDA > > 2024-02-14 * "Buying some NVDA" "" > Assets:Stocks:NVDA > 2.00 NVDA {733.09 USD} > Assets:Cash > > 2024-05-31 balance Assets:Stocks:NVDA > 2 NVDA > 2024-05-31 balance Assets:Cash > 0.00 USD > > The pre-split stock price (per Yahoo and bean-price) was 1,096.33, and my > Fidelity account confirms that I have 20 shares. Per the docs[1], I would do > (I think): > > 2024-06-02 * "NVDA 10:1 stock split" "" > Assets:Stocks:NVDA > -2 NVDA {1,096.33 USD} > Assets:Stocks:NVDA > 50 NVDA {109.633 USD} > > bean-check fails, however: > > nvidia_split.beancount:24: No position matches > "Posting(account='Assets:Stocks:NVDA', units=-2 NVDA, > cost=CostSpec(number_per=Decimal('1096.33'), number_total=None, > currency='USD', date=None, label=None, merge=False), price=None, flag=None, > meta={'filename': 'nvidia_split.beancount', 'lineno': 29})" against balance > (2.00 NVDA {733.09 USD, 2024-02-14}) > > Explicitly using the lot in that transaction fails, too: > > 2024-06-02 * "NVDA 10:1 stock split" "" > Assets:Stocks:NVDA -2 NVDA {733.09 USD, 2024-02-14} @ 1096.33 USD > Assets:Stocks:NVDA 20 NVDA {109.633 USD} > > The error is: > > nvidia_split.beancount:24: Transaction does not balance: (726.4800 USD) > > 2024-06-02 * "NVDA 10:1 stock split" "" > Assets:Stocks:NVDA -2.00 NVDA {733.09 USD, 2024-02-14} @ 1096.33 USD
I write those as (but I also include a label): Assets:Stocks:NVDA -2 NVDA {733.09 USD, 2024-02-14} @ 733.09 USD Assets:Stocks:NVDA 20 NVDA {73.309 USD, 2024-02-14} IMO the basis and purchase date of this lot should not be changed by a split. $ hld Account Units Currency Cost Currency Average Cost Price Book Value Market Value ------------------ --------- -------- ------------- ------------ ----- ---------- ------------ Assets:Cash -1,466.18 USD USD -1,466.18 -1,466.18 Assets:Stocks:NVDA 20.00 NVDA USD 73.31 1,466.18 ------------------ --------- -------- ------------- ------------ ----- ---------- ------------ > > So it seems the price of 1096.33 is being ignored and I’m trying to purchase > 20 shares at 109.633 USD using 2*733.09 USD and the “gain” of 363.24 USD per > share is being lost. > > What is the proper way to reflect a stock split? > > Thanks, > Brian > > [1]: https://beancount.github.io/docs/trading_with_beancount.html#stock-splits > — > Brian Lalor (he/him) > bla...@bravo5.org > -- 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/q4dkkk-f7i.ln1%40anthive.com.