Beancount does not deal with splits explicitly.
This means that the time series of your price will have a jump at the time
of the stock split.
Building this properly is out of scope and I've found it not worthwhile;
there are many more corporate actions it would have to take into account,
e.g., spinoff of shares and that's worthy of building in something that
serves market data, but not super important in an accounting system.



On Wed, Jun 26, 2024 at 9:38 AM Brian Lalor <[email protected]> wrote:

> Alright, I see.  Thank you.
>
> If it’s not already obvious, I’m quite naïve about trading. Given that
> most (if not all?) historical price records seem to have been retroactively
> updated for all cumulative splits (ie
> https://finance.yahoo.com/quote/NVDA/ shows the 2024-02-14 closing price
> as 73.90 USD), is there any reason not to just update the original
> transaction in my ledger?
>
> —
> Brian Lalor (he/him)
> [email protected]
>
> On Jun 22, 2024, at 9:34 PM, Martin Blais <[email protected]> wrote:
>
> 2024-06-02 * "NVDA 10:1 stock split" ""
>     Assets:Stocks:NVDA     -2 NVDA {733.09 USD, 2024-02-14}
>     Assets:Stocks:NVDA     2*10 NVDA {733.09/10 USD}
>
> You don't realize gains on a split
>
>
>
>
>
>
> On Sat, Jun 22, 2024 at 8:42 PM Brian Lalor <[email protected]> wrote:
>
>> Like this?
>>
>> 2024-06-02 * "NVDA 10:1 stock split" ""
>>     Assets:Stocks:NVDA
>>     -2 NVDA {733.09 USD, 2024-02-14}
>>     Assets:Stocks:NVDA
>>     20 NVDA {109.633 USD}
>>
>>
>> But that doesn’t balance.
>>
>> —
>> Brian Lalor (he/him)
>> [email protected]
>>
>> On Jun 22, 2024, at 8:16 PM, Martin Blais <[email protected]> wrote:
>>
>> You bought your NVDA at 733.09 not 1096.33, that's what you have to
>> provide in the cost for the -2 leg.
>> The docs are correct.
>>
>>
>> On Sat, Jun 22, 2024 at 5:32 PM Brian Lalor <[email protected]> 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
>>>      Assets:Stocks:NVDA     20 NVDA {109.633 USD, 2024-06-02}
>>>
>>> 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)
>>> [email protected]
>>>
>>> --
>>> 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/C9EBE17D-A95F-4018-B979-59831C301DFB%40bravo5.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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/CAK21%2BhMXg654ZmD8N%2BedrJuCzSah2hrX0apH1Q6o%3D2%3DxP80kQQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beancount/CAK21%2BhMXg654ZmD8N%2BedrJuCzSah2hrX0apH1Q6o%3D2%3DxP80kQQ%40mail.gmail.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/EBF195B5-FA6C-476B-9925-0DADC70FADA2%40bravo5.org
>> <https://groups.google.com/d/msgid/beancount/EBF195B5-FA6C-476B-9925-0DADC70FADA2%40bravo5.org?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/CAK21%2BhNGvUFRtQmK9jskoGCPidmahv6aOf_hpqTHmZGYYsEvPA%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAK21%2BhNGvUFRtQmK9jskoGCPidmahv6aOf_hpqTHmZGYYsEvPA%40mail.gmail.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/CAF6E8D1-6E0B-47F4-A9B6-E77C1C18AD69%40bravo5.org
> <https://groups.google.com/d/msgid/beancount/CAF6E8D1-6E0B-47F4-A9B6-E77C1C18AD69%40bravo5.org?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/CAK21%2BhOrUwFLda0bFMK%2BGp3-3SBW5eyVY7J%3DBy_mcY1S%3D_kReg%40mail.gmail.com.

Reply via email to