Visitar URL original
1.99.5: `holdings` totals skip fully disposed accounts · Issue #2769 · hledgerorg/hledger · GitHub
Skip to content

1.99.5: holdings totals skip fully disposed accounts #2769

Closed

Description

@wgslr

The docs of hledger holdings --help says:

Fully disposed commodities and accounts are not shown, unless you add
-E/--empty. (But the RGain and XIRR in the totals row always includes
them.
)

In practice, the RGain from closed accounts is missing if -E or -t is not added.

Example journal:

commodity 1.NVDA  ; lots:
commodity 1.AAPL  ; lots:

2026-09-01 Buy Apple
  assets   -10e
  stocks:appl   2APPL {}

2026-09-02 Buy Nvidia
  assets   -20e
  stocks:nvda   2NVDA {}

2026-09-04 Sell Apple
  assets   40e
  stocks:appl   -2APPL {}

RGain missing:

[0]$ hledger-lots hold -f hledger.journal
Holdings on 2026-10-06

             ||       Date  Age  Units  Avg cost  Unit price  Total cost  Total value  Weight  UGain  UGain%  RGain  XIRR
=============++===========================================================================================================
 stocks:nvda || 2026-09-02  34d  2NVDA       10e                     20e
-------------++-----------------------------------------------------------------------------------------------------------
             ||                  2NVDA       10e                     20e

RGain visible:

$ hledger-lots hold -f hledger.journal -t
Holdings on 2026-10-06

        ||       Date  Age  Units  Avg cost  Unit price  Total cost  Total value  Weight  UGain  UGain%  RGain  XIRR
========++===========================================================================================================
 stocks || 2026-09-02  34d  2NVDA       10e                     20e
   nvda || 2026-09-02  34d  2NVDA       10e                     20e
--------++-----------------------------------------------------------------------------------------------------------
        ||                  2NVDA       10e                     20e                                        30e

$ hledger-lots hold -f hledger.journal -E
Holdings on 2026-10-06

             ||       Date  Age  Units  Avg cost  Unit price  Total cost  Total value  Weight  UGain  UGain%  RGain  XIRR
=============++===========================================================================================================
 stocks:appl ||                  0APPL                                                                          30e
 stocks:nvda || 2026-09-02  34d  2NVDA       10e                     20e
-------------++-----------------------------------------------------------------------------------------------------------
             ||                  2NVDA       10e                     20e                                        30e

Version

hledger 1.99.5, linux-x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.annoyance4-majorMajor usability/doc bug, or any regression or crash.investingRelated to investments, lots, capital gains, etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions