On Wed, Aug 9, 2023 at 1:38 PM Daniele Nicolodi <dani...@grinta.net> wrote:

> >
> > At first I thought acquisition dates were not shown because SUM() is
> > aggregating the amounts of lots with different dates, but now I'm not
> > sure.  Is acquisition date tracked?  Should it be?  If it's not, is it
> > likely user error in how I entered my transactions?
>
> AFAIK acquisition date is always tracked. However, when I implemented
> the column rendering code for columns reporting postings and inventories
> I decided to use a compact representation without the date and optional
> labels. This choice can be revisited.
>

Thank you for the confirmation and explanation.  The compact representation
is reasonable.  I discovered the cost_date column which allowed me to debug
this and see what was going on inside.


> > *2. How exactly is cost munged in an asset transfer?*
> >
> > I'm looking at inventories (as reported by the previous query) before
> > and after a transfer from one account to another.  I can see a selection
> > of lots disappear from the inventory of the debited account.  I had
> > thought these lots would appear in the same form in the credited
> > account, but instead I see them aggregated into a single lot with what
> > appears to be an averaged cost.
> >
> > Is it possible to transfer the lots without collapsing?  In conjunction
> > with my previous question, I think it will be necessary to transfer
> > without collapsing in order to preserve acquisition dates on the cost,
> > which will be needed to determine STCG vs LTCG.  Or perhaps the lots are
> > being collapsed /because/ I don't have dates attached, perhaps due to
> > user error?
>
> 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/CAFXPr0uekELQ0feQYDNFrN8VD%2BS59vTcZOivfApaWOTW3nvmNg%40mail.gmail.com.

Reply via email to