On 2024-02-03, lipp f wrote:
> For tax purposes, I need maximum balance of an investment account during 
> the tax year. reg -J sorted doesn't actually give me that. When using reg, 
> it needs to do a cumulative sum, on top of the initial balance.

Hmm, pretty sure the solution provided does literally that?

Breaking it down...

> -d 'd >= [2023] & d < [2024]'
This is a display filter, which means transactions are included in
totals even if they're not displayed.

You need this to calculate the correct initial balance.

> -V
This just means you want the market value, because you didn't specify if
this was a commodity account or a bank account.

> -J
This only outputs the date and the total, which is all you wanted and is
easier to process.

> sort -g -k2
Now sort that output by running total, so the highest balance you ever
had will be at the end.

> tail -1
Only print the highest balance, and throw the rest away.

If that's not what you're looking for, can you give an example?

Tavis.

>
> On Saturday, February 3, 2024 at 3:33:05 PM UTC-5 Tavis Ormandy wrote:
>
>> On 2024-02-03, lipp f wrote:
>> > TIA.
>> >
>>
>> Are you only interested in cases that a /transaction/ causes the maximum
>> balance to be reached (e.g. you deposited some cash)?
>>
>> Maybe something like this?
>>
>> $ ledger reg -JVd 'd > [2023] & d < [2024]' ^Assets:Checking \
>> | sort -g -k2 \
>> | tail -1
>>
>> I think you need the display filter, because --period would set the
>> starting balance to 0.
>>
>> I guess you could do --sort 'account.value(d)' or something, but that
>> would be kinda slow.
>>
>> If you also care about the case where the market value of a commodity
>> increases, then I guess the answer is similar, but you need something
>> like `--daily` or `--weekly`.
>>
>> I dunno, maybe someone else has a cleaner solution :)
>>
>> Tavis.
>>
>> -- 
>> _o) $ lynx lock.cmpxchg8b.com
>> /\\ _o) _o) $ finger [email protected]
>> _\_V _( ) _( ) @taviso
>>
>>
>


-- 
 _o)            $ lynx lock.cmpxchg8b.com
 /\\  _o)  _o)  $ finger [email protected]
_\_V _( ) _( )  @taviso

-- 

--- 
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 on the web visit 
https://groups.google.com/d/msgid/ledger-cli/upmfcf%24110b%241%40ciao.gmane.io.

Reply via email to