hledger-interest icon indicating copy to clipboard operation
hledger-interest copied to clipboard

Fails for multi-currency journals

Open schoettl opened this issue 2 years ago • 5 comments

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.

schoettl avatar Aug 17 '21 16:08 schoettl

Beside that, I wonder why I don't get interests in half a year?

schoettl avatar Aug 17 '21 16:08 schoettl

You can have any interest interval you want with --annual-schedule.

peti avatar Sep 27 '21 09:09 peti

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?

schoettl avatar Oct 16 '21 11:10 schoettl

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.

peti avatar Nov 01 '21 08:11 peti

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

schoettl avatar Nov 01 '21 09:11 schoettl