I'm glad my suggestion opened up a solution pathway!

I'm no accountant; just a curious dev. So I know even less about tax laws
around capital gains. There's not much I can do at this point with out an
example ledger. If you can, without sharing details of what you're working
on, please share an example ledger which has the issues you're trying to
solve. If I can't get to it, someone else in the group can.

Thank you!


*Igbanam*


On Thu, Oct 2, 2025 at 12:21 PM 'Pranshu Goyal' via Ledger <
[email protected]> wrote:

> I didn't know about this option, thanks for introducing it. I tried it
> out. It does what it says on the tin, and works even for csv reports, but I
> see these issues:
>
> -  it doesn't seem to work with dates. None of the date filters, -b, -p
> seem to narrow the report for a period. I need this to figure out capital
> gains(realized) in a financial year.
> - I'm unable to use --unrealized to figure out the realized gains from the
> total gains. In my data there's a commodity with just two transactions,
> first bought and then all units sold at a loss. For this commodity the
> --unrealized flag calculates the loss correctly but shows it as unrealized
> which seems to be incorrect, as when the commodity is sold the loss becomes
> realized.
>
> These issues aside, in principle it should solve my problem. Yet it
> doesn't because not all capital gains are considered equal due to the ever
> changing minutiae of tax laws which ledger can't be expected to
> incorporate. I'm trying to use ledger for comprehensive tax filing, and
> Capital gains is the only part remaining. Hence I turned to scripting on
> the generated csv reports.
>
> Pranshu Goyal
>
>
> On Thu, 2 Oct 2025 at 12:31, Igbanam Ogbuluijah <[email protected]>
> wrote:
>
>> I may not fully understand this, but does *bal -G* work? If you have the
>> details in ledger, and you're looking for gains at a particular time, this
>> should work; no?
>>
>>
>> *Igbanam*
>>
>>
>> On Thu, Oct 2, 2025 at 5:03 AM Pranshu Goyal <[email protected]>
>> wrote:
>>
>>> I'm trying to write a script to calculate capital gains. For this I
>>> intend to get a csv register report on some accounts with lot prices data,
>>> and then do the capital gains calculation in the script. But the csv report
>>> with such a query doesn't give me lot prices data:
>>>
>>> > ledger csv stocks --lot-prices
>>>
>>> It only outputs the number of units bought or sold. I also tried looking
>>> into format strings
>>> <https://ledger-cli.org/doc/ledger3.html#Format-Strings-1> but found no
>>> option to get lots data. Am I missing something or the feature isn't there?
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Ledger" 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/ledger-cli/5ce280cd-88f8-44e2-8d82-1e59119dd942n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ledger-cli/5ce280cd-88f8-44e2-8d82-1e59119dd942n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ledger" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ledger-cli/zCeEnQTyVAU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion visit
>> https://groups.google.com/d/msgid/ledger-cli/CAOmRJrcyzkLXZEfdHn5ScDnSBMpRuDF1uVgpb9qWFMBsVamoLg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ledger-cli/CAOmRJrcyzkLXZEfdHn5ScDnSBMpRuDF1uVgpb9qWFMBsVamoLg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ledger" 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/ledger-cli/CANG9ym00M%2BdJqhRFU2ui33Ct-vd049r1kY7zyuCROGfC-Lv%3DVw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ledger-cli/CANG9ym00M%2BdJqhRFU2ui33Ct-vd049r1kY7zyuCROGfC-Lv%3DVw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" 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/ledger-cli/CAOmRJrf7wMU1gaDq66eFBamxH_QNL_Roi4bYJNaC%2BDC3Cd%3D_sg%40mail.gmail.com.

Reply via email to