How do you use bean-doctor context to figure out inventory as you mention here? I can't get it to work.
On Saturday, June 21, 2025 at 11:57:22 AM UTC-4 [email protected] wrote: > What's in your inventory prior to the transaction? > I bet it has postings that are either not at cost (an input error). > Use bean-doctor context to resolve those issues. > > > On Fri, Jun 20, 2025 at 7:06 PM Alex Kaufman <[email protected]> wrote: > >> Thank you for the help here. It sounds like the most straightforward >> option for transferring accounts with average cost booking without >> realizing nonexistent profit or changing the cost basis then is the final >> option you mentioned. >> >> I attempted the following transaction and receive an error "Too many >> missing numbers for currency group 'USD'" . >> >> 2025-01-03 * "transfer" >> Assets:Broker1:STOCK -20.00 STOCK {} >> Assets:Broker2:STOCK 20.00 STOCK {USD} >> >> On Friday, June 20, 2025 at 7:57:39 AM UTC-7 Martin Blais wrote: >> >>> On Fri, Jun 20, 2025 at 6:47 AM Alex Kaufman <[email protected]> wrote: >>> >>>> Hello, I have been reading through docs and trying to make heads or >>>> tails of how to do this operation. Recently I consolidated retirement >>>> accounts. As part of this process my holdings were transferred over >>>> directly from one account to the other. I am sure I am misunderstanding >>>> something but I have been testing various methods for a while and cannot >>>> figure out the right way to approach this problem. Any recommendations for >>>> ways to reframe the problem or think about it differently instead of just >>>> accomplishing the immediate goal are welcome and encouraged. >>>> >>>> It may be as simple as my misunderstanding price/cost or the cost and >>>> market value views in fava. I could also be drastically over complicating >>>> things. Thank you all in advance for your help! Below is an initial state >>>> beancount file to provide a minimal example. I have also included two >>>> examples of some potential transfer transactions to append to the setup >>>> file and the reasons why they dont really work. >>>> >>>> Broker1 is set up as "NONE" bookkeeping due to the way the broker >>>> provided statements. This was a major motivator for migrating to Broker2. >>>> >>>> option "operating_currency" "USD" >>>> >>>> 2024-01-01 open Assets:BankAccount >>>> 2024-01-01 open Equity:Opening-Balances >>>> >>>> 2024-01-02 pad Assets:BankAccount Equity:Opening-Balances >>>> 2024-01-03 balance Assets:BankAccount 100 USD >>>> >>>> 2024-12-31 open Assets:Broker1:STOCK "NONE" >>>> 2024-12-31 open Assets:Broker2:STOCK >>>> >>>> 2025-01-01 * "invest 1" >>>> Assets:Broker1:STOCK 10.00 STOCK {1.00 USD} >>>> Assets:BankAccount -10.00 USD >>>> >>>> 2025-01-02 * "invest 2" >>>> Assets:Broker1:STOCK 10.00 STOCK {2.00 USD} >>>> Assets:BankAccount -20.00 USD >>>> >>>> *Example 1:* >>>> >>>> 2025-01-03 * "transfer" >>>> Assets:Broker1:STOCK -10.00 STOCK {} >>>> Assets:Broker2:STOCK 10 STOCK >>>> >>>> Here is one attempt I have tried. It sort of works in that there are no >>>> errors shown in fava but in the cost and market value views it doesnt >>>> convert to USD. >>>> >>> >>> Here it doesn't know what to do; Do you want to exchange dollars? >>> You're only saying STOCK units on the second posting. >>> This gets resolved as >>> >>> 2025-01-03 * "transfer" >>> Assets:Broker1:STOCK -20.00 STOCK {USD} >>> Assets:Broker2:STOCK 20 STOCK {{40.00 USD}} >>> >>> (Use the "bean-doctor context" command) >>> Regardless, this input is incorrect. >>> >>> >>> >>>> >>>> [image: Screenshot 2025-06-19 at 9.50.10 PM.png] >>>> >>>> Example 2: >>>> >>>> 2025-01-03 * "transfer" >>>> Assets:Broker1:STOCK -20.00 STOCK {USD} >>>> Assets:Broker2:STOCK 20 STOCK {{40.00 USD}} >>>> >>>> >>>> Another attempt I have made is to change the transfer according to the >>>> syntax defined in github issue 476 >>>> <https://github.com/beancount/beancount/issues/476>. If I do not >>>> specify the cost of the stock in broker 2 I get an error stating the >>>> transaction is not balanced. However if I do specify the current >>>> price/cost >>>> of the stock it seems to show that there has been a $10 negative balance >>>> to >>>> Broker 1. In the MarketValue view this shows correctly.. >>>> >>> >>> But you don't have $40 of cost basis. You have $30 of cost basis. Try >>> with that (which is correctd). >>> It will resolve as >>> >>> 2025-01-03 * "transfer" >>> Assets:Broker1:STOCK -10.00 STOCK {1.00 USD, 2025-01-01} ; -10.0000 >>> USD >>> Assets:Broker1:STOCK -10.00 STOCK {2.00 USD, 2025-01-02} ; -20.0000 >>> USD >>> Assets:Broker2:STOCK 20.00 STOCK {1.50 USD, 2025-01-03} ; 30.00 >>> USD >>> >>> >>> >>> >>> >>> >>>> >>>> >>>> [image: Screenshot 2025-06-19 at 9.59.39 PM.png] >>>> >>>> Example 3: >>>> >>>> 2025-01-03 * "transfer" >>>> Assets:Broker1:STOCK -20.00 STOCK {} @ 2.00 USD >>>> Assets:Broker2:STOCK 20.00 STOCK {{40.00 USD}} >>>> Income:Investment -10.00 USD >>>> >>>> This option resolves the confusion in both the cost and market value >>>> views. However now we are including a sort of fake income that we havent >>>> actually realized. >>>> >>> >>> No. You're realizing the profit here and erroneously stepping up your >>> cost basis to $40. >>> This is what it resolves to: >>> >>> 2025-01-03 * "transfer" >>> Assets:Broker1:STOCK -10.00 STOCK {1.00 USD, 2025-01-01} @ 2.00 USD >>> ; -10.0000 USD >>> Assets:Broker1:STOCK -10.00 STOCK {2.00 USD, 2025-01-02} @ 2.00 USD >>> ; -20.0000 USD >>> Assets:Broker2:STOCK 20.00 STOCK {2.00 USD, 2025-01-03} >>> ; 40.00 USD >>> Income:Investment -10.00 USD >>> ; -10.00 USD >>> >>> >>> >>>> It also requires that we know the exact amount of that income because >>>> leaving the specific value blank to try to soak up any income results in >>>> the error Too many missing numbers for currency group 'USD', In my >>>> case I dont know the exact income value for each of the stocks coming over >>>> from broker1 to broker 2 because it is a retirement account and is >>>> basically using average bookkeeping. >>>> >>>> >>>> If you're not selling you want to avoid realizing _any_ income. >>> You want to close all the postings in the account prior to the >>> transaction. >>> You can either list all the postings using "bean-doctor context" and >>> copy them over, or, use the total number of units, which should >>> unambiguously resolve to all the postings. >>> >>> 2025-01-03 * "transfer" >>> Assets:Broker1:STOCK -20.00 STOCK {} >>> Assets:Broker2:STOCK 20.00 STOCK {USD} >>> >>> resolves to >>> >>> 2025-01-03 * "transfer" >>> Assets:Broker1:STOCK -10.00 STOCK {1.00 USD, 2025-01-01} ; -10.0000 >>> USD >>> Assets:Broker1:STOCK -10.00 STOCK {2.00 USD, 2025-01-02} ; -20.0000 >>> USD >>> Assets:Broker2:STOCK 20.00 STOCK {1.50 USD, 2025-01-03} ; 30.0000 >>> USD >>> >>> >>> On the opening sice, if you want to replicate all the same postings, you >>> could do this instead: >>> >>> 2025-01-03 * "transfer" >>> Assets:Broker1:STOCK -10.00 STOCK {1.00 USD, 2025-01-01} >>> Assets:Broker1:STOCK -10.00 STOCK {2.00 USD, 2025-01-02} >>> Assets:Broker2:STOCK 10.00 STOCK {1.00 USD, 2025-01-01} >>> Assets:Broker2:STOCK 10.00 STOCK {2.00 USD, 2025-01-02} >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>> >>>> >>>> -- >>>> 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 visit >>>> https://groups.google.com/d/msgid/beancount/d798059c-af75-4622-b5c8-adb0a7666154n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/beancount/d798059c-af75-4622-b5c8-adb0a7666154n%40googlegroups.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 visit >> https://groups.google.com/d/msgid/beancount/c5781530-b8fd-48be-921f-8b96bb13d9c0n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beancount/c5781530-b8fd-48be-921f-8b96bb13d9c0n%40googlegroups.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 visit https://groups.google.com/d/msgid/beancount/2f8baef4-46cf-4663-ad0c-963b64e95742n%40googlegroups.com.
