hledger-interest
hledger-interest copied to clipboard
Fails for multi-currency journals
With the current version of hledger-interest from stackage, it fails for multi-currency journals.
As a minimal example, I provide a shelltest file:
<
2021-01-01 deposit
assets 100 €
income
2021-01-01 deposit
assets 100 $
income
2021-07-01 deposit
assets 100 €
income
$ hledger-interest -f- -s income:interest -t assets:interest --act --constant=0.01 --quiet assets
>
2021/07/01 1% interest for 100 $, 100 € over 181 days
assets:interest 0
assets:interest 0
income:interest 0
income:interest 0
Install shelltestrunner und run with shelltest this-file.test
. The problematic output of hledger-interest is this:
2021/07/01 1% interest for 100 $
100 € over 181 days
assets:interest 0
assets:interest 0
income:interest 0
income:interest 0
It's obviously not a valid hledger journal file.
Beside that, I wonder why I don't get interests in half a year?
You can have any interest interval you want with --annual-schedule
.
You can have any interest interval you want with --annual-schedule.
You mean without that option, the interest rate is only "paid" at the end of a year? But then, why is the transaction "1% interest for …" with 0 printed in the example above? If it's not paid?
You mean without that option, the interest rate is only "paid" at the end of a year? But then, why is the transaction "1% interest for …" with 0 printed in the example above? If it's not paid?
Interest transactions are generated on two occasions: at the end of the interest period and every time the account's balance changes.
OK... So if I want to know current interests during the year, I can add a zero-transaction today...
But is it intended that hledger-interest seems to round or floor interrests? In this example I'd expect 0,5 € interests but get 0 €.
<
2021-01-01 deposit
assets 100
income
2021-07-01 zero transaction
assets 0
income
$ hledger-interest -f- -s income:interest -t assets:interest --bgb288 --constant=0.01 --quiet assets
>
2021-07-01 1% interest for 100 over 181 days
assets:interest 0.5
income:interest -0.5