Exporting value changes

22 views
Skip to first unread message

the.so...@gmail.com

unread,
Oct 18, 2021, 7:12:49 PMOct 18
to hledger
Dear all,
I keep a pricedb with the almost daily NAV, i.e., price, of the mutual funds that I own.  Each mutual fund has its own commodity symbol (I use the ISIN as the commodity symbol).

It would be nice to see a graph of the total value of the mutual funds I own.  Is there any way to export the value information on a date-wise basis from hledger (to a csv file?) so that I can plot it in a graph?

Would I need to run a separate shell script with a loop with 

`hledger bal Assets cur:{commodity-name} --value={date} -O csv` 

for each commodity name and each date?  Or is there some in-built way to deal with this (I'm guessing rather common demand) in hledger?

Regards,
Pranesh

Simon Michael

unread,
Oct 19, 2021, 12:51:17 PMOct 19
to hle...@googlegroups.com
Quick answer: 
bal -VD --commodity-column -O csv 
?

On Oct 18, 2021, at 13:12, the.so...@gmail.com <the.so...@gmail.com> wrote:

Dear all,
--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hledger/86b9e070-dcad-4ce6-a190-f8a666597ee2n%40googlegroups.com.

the.so...@gmail.com

unread,
Oct 20, 2021, 3:57:16 PMOct 20
to hledger
On Tuesday, 19 October, 2021 at 10:21:17 pm UTC+5:30 Simon Michael (sm) wrote:
Quick answer: 
bal -VD --commodity-column -O csv 
?

Unfortunately, `-VD` doesn't give me the value as calculated on each day (as `--value={date}` does), only the value on the days with transactions.

So, if I run:
`hledger bal -VD --commodity-column -O csv date:2021-10-01 cur:INF732E01045`

I get no values:
"account","commodity","2021-10-01"

However, if I run:
`hledger bal Assets cur:INF732E01045 --value=2021-10-01 --commodity-column -O csv`

I get:
"account","commodity","balance"
"Assets:Investment:Equity:Shares:JUNIORBEES","₹","9,055.00"
"total","₹","9,055.00"

Is there any other way to force `-D` to calculate the value as on that date?  I've tried `--value=then` and `--value=end` but neither helps.


 

Simon Michael

unread,
Oct 20, 2021, 7:08:07 PMOct 20
to hle...@googlegroups.com
Your date: is limiting it to one day I think. Try date:2021-10 instead ? 

On Oct 20, 2021, at 09:57, the.so...@gmail.com <the.so...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.

the.so...@gmail.com

unread,
Oct 24, 2021, 4:35:34 PMOct 24
to hledger
Using `date:2021-10` doesn't help, since `bal -VD` doesn't actually calculate the value on each particular day.  The output of `hledger bal -VD --commodity-column -O csv date:2021-10 cur:INF732E01045` is simply the header row:

```
"account","commodity","2021-10-01","2021-10-02","2021-10-03","2021-10-04","2021-10-05","2021-10-06","2021-10-07","2021-10-08","2021-10-09","2021-10-10","2021-10-11","2021-10-12","2021-10-13","2021-10-14","2021-10-15","2021-10-16","2021-10-17","2021-10-18","2021-10-19","2021-10-20","2021-10-21","2021-10-22","2021-10-23","2021-10-24","2021-10-25","2021-10-26","2021-10-27","2021-10-28","2021-10-29","2021-10-30","2021-10-31"
```

As I mentioned earlier:

> Unfortunately, `-VD` doesn't give me the value as calculated on each day (as `--value={date}` does), only the value on the days with transactions.

Simon Michael

unread,
Oct 24, 2021, 5:56:02 PMOct 24
to hledger
Sorry, I'm not following/understanding in full detail. But it should be easy to see daily value of things - perhaps -H is what's needed ? If not, I could clear it up on chat.





the.so...@gmail.com

unread,
Oct 25, 2021, 6:55:28 AMOct 25
to hledger
That's it!  The `-H` is what I was missing.

So this command gives me exactly what I'm looking for:
```
hledger bal cur:'INF.*' '^Assets' --historical --daily --value=end --transpose --drop 4 -O csv
```
Thanks, Simon!

Cheers,
Pranesh
Reply all
Reply to author
Forward
0 new messages