Your example doesn't involve transferring. You're buying a brand new lot of 9 units (short) in A, and buying a brand new lot of 9 units (long) in B. Specify the lot to transfer. Use `balances` inside bean-query to confirm.
On Tuesday, August 15, 2023 at 5:35:44 PM UTC-7 erical...@gmail.com wrote: > So, I've made a bunch of progress on many of my issues, but I > haven't yet figured out how to get cost tracking through transfers > working. It's illustrated by example in the below email. > > Any suggestions on how to start attacking this are welcome. I > am willing to jump into beancount core code if need be -- I am > actually not even entirely sure what work, if any, is needed > there (see my questions on this other thread > <https://groups.google.com/g/beancount/c/vDX1oA2mJXA/m/Y8yZqUqPAQAJ>) > > thanks, > eric > > On Wed, Aug 9, 2023 at 3:36 PM Eric Altendorf <erical...@gmail.com> wrote: > >> On Wed, Aug 9, 2023 at 1:38 PM Daniele Nicolodi <dan...@grinta.net> >> wrote: >> >>> >>> I'm not sure I understand what you are trying to do, what beancount >>> does, and what you expect it to be doing. Can you present a minimal >>> ledger that shows the problem? >>> >> >> Sure, here is one. Perhaps my understanding or expectations are wrong >> (or I've made a dumb typo). >> >> 2000-01-01 open Equity:Opening-Balances >> 2020-01-01 open Assets:BrokerA:USD USD >> 2020-01-01 open Assets:BrokerA:ASSET ASSET >> 2020-01-01 open Assets:BrokerB:ASSET ASSET >> >> 2020-01-01 pad Assets:BrokerA:USD Equity:Opening-Balances >> 2020-01-02 balance Assets:BrokerA:USD 100.00 USD >> >> 2020-02-01 * "Buy some ASSET" >> Assets:BrokerA:ASSET 5.00 ASSET {10.00 USD} >> Assets:BrokerA:USD -50.00 USD >> >> 2020-03-01 * "Buy some more ASSET" >> Assets:BrokerA:ASSET 4.00 ASSET {12.50 USD} >> Assets:BrokerA:USD -50.00 USD >> >> 2020-05-01 * "Transfer ASSET" >> Assets:BrokerA:ASSET -9.00 ASSET >> Assets:BrokerB:ASSET 9.00 ASSET >> >> >> Now I try these two queries on the ledger: >> >> beanquery> SELECT account, position, cost_date FROM has_account("Assets") >> CLOSE ON 2020-04-01 >> account position cost_date >> ----------------------- ------------------------- ---------- >> Assets:BrokerA:USD 100.00 USD >> Equity:Opening-Balances -100.00 USD >> Assets:BrokerA:ASSET 5.00 ASSET {10.00 USD} 2020-02-01 >> Assets:BrokerA:USD -50.00 USD >> Assets:BrokerA:ASSET 4.00 ASSET {12.50 USD} 2020-03-01 >> Assets:BrokerA:USD -50.00 USD >> >> beanquery> SELECT account, position, cost_date FROM has_account("Assets") >> CLOSE ON 2020-06-01 >> account position cost_date >> ----------------------- ------------------------- ---------- >> Assets:BrokerA:USD 100.00 USD >> Equity:Opening-Balances -100.00 USD >> Assets:BrokerA:ASSET 5.00 ASSET {10.00 USD} 2020-02-01 >> Assets:BrokerA:USD -50.00 USD >> Assets:BrokerA:ASSET 4.00 ASSET {12.50 USD} 2020-03-01 >> Assets:BrokerA:USD -50.00 USD >> Assets:BrokerA:ASSET -9.00 ASSET >> Assets:BrokerB:ASSET 9.00 ASSET >> >> Before the transfer, it appears the the two lots appear separately in >> BrokerA with a cost and date. After the transfer, in the BrokerB account, >> they've been merged with no cost or date. >> >> If I annotate one, the other, or both legs of the transfer transaction in >> the ledger, with either "{USD}" or "{}" cost specs, I can induce various >> other behaviors, but I'm just acting like a monkey with a keyboard :) , and >> none of them are what I want, which is for BrokerB to contain both lots >> with the original cost info. >> >> I think this is the same question I asked here: >> https://groups.google.com/g/beancount/c/vDX1oA2mJXA/m/Y8yZqUqPAQAJ >> >> eric >> > -- 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/7835f45f-a836-4dba-b66e-4d391826b13fn%40googlegroups.com.