This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Loan shedule vs actual issue

Tags: None
(comma "," separated)
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Loan shedule vs actual issue

Sat Jan 21, 2023 4:26 am
Greetz,

I'm looking to troubleshoot the following:

I have a loan account set up that has weekly payments. Each week, on the payment date, the scheduled payment in the loan ledger matches the amount expected, however as soon as I import the payment transaction in the payment amount from the bank's online OFX, the actual split amount into the loan payment (principal payment) is off by a few pennies, consistently (same amount difference from week to week between the schedule and what gets split incorrectly).

In other words, assume weekly payments of, 101, 102, 103 104:
Week 1 KMM correctly shows 101 as an upcoming loan payment transaction in the ledger from the schedule built during the loan amount setup
When transactions are imported into the payment amount, KMM matches the imported transaction to the payment amount from the schedule and does the split
But the split amount is 101.10 instead of 101
Week 2, KMM shows 102 in the ledger schedule however at import it is 102.10 instead of 102
Week 3, KMM shows 103 in the ledger schedule however at import it is 103.10 instead of 103
etc...
It always consistently has the same difference from payment to payment.

I hope the above is clear enough.

Has anyone seen this before? Any other feedback I can provide to solve this? I can dig into the XML.

Running on 5.1.1-dcc7ca980

Many thanks!

Last edited by tcpsorcerer on Sat Jan 21, 2023 3:58 pm, edited 1 time in total.
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Sat Jan 21, 2023 3:57 pm
Sorry, typo in the title, should be "Loan Schedule vs actual issue". Now corrected.

I really need to stop casting spells when I'm tired...
User avatar
ostroffjh
Registered Member
Posts
253
Karma
0
OS

Re: Loan shedule vs actual issue

Sat Jan 21, 2023 7:12 pm
That version is about two year old. I don't know if it matters or not, but it would be worth updating to 5.1.3, just in case.

For each week, you have two transactions which should get matched. One is the scheduled transaction and the other is the imported transaction. Can you check which of the two is actually introducing the "wrong" split? Also, is there any interest involved? If so, then the payments can be changing the amounts of the repayment and interest splits, although that does not necessarily explain your problem.
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Sat Jan 21, 2023 9:05 pm
Thank you, will get the new version to test. I'm on windows if it makes any difference.

To be clear, the scheduled transaction is correct in the Loan ledger based on the loan schedule report from the bank. The discrepancy appears right after I update the transactions into the payment account to that loan. Not sure if that is making sense. So if I'm understanding you, it is the Imported transaction causing it. Reason I say this is, before the import, the upcoming weekly payment and loan balance (from the schedule) in the ledger, match the expected amounts per the loan schedule table from the bank.

Is 5.1.3 available here https://binary-factory.kde.org/job/KMyMoney_Release_win64/lastSuccessfulBuild/artifact/ ?
User avatar
ostroffjh
Registered Member
Posts
253
Karma
0
OS

Re: Loan shedule vs actual issue

Sat Jan 21, 2023 9:30 pm
Windows does have some specific issues, but I don't think that is the case here. However, we might still have some terminology issues.

Was the schedule created by creating a loan (with interest) or is it just a schedule for the monthly payments, which are not supposed to change? What type of account/accounts is/are involved here? Was the schedule created as part of creating a loan, or just a schedule for weekly payments of a fixed amount? Are any of the transactions (before or after importing) split transactions? I'm trying to determine if the problem is with the total amount of the transaction, or with the amount(s) of specific splits.

The scheduled transaction is only "virtual" until you explicitly enter it, at which point it becomes a real transaction, even if it appears in the ledger. When you import the transaction from the bank, I would not expect it to match to the existing transaction unless the amounts are the same, so there is something that doesn't make sense. In fact, you might try to import from the bank before you enter the scheduled transaction, so you can see exactly what the bank is sending. It might also be worth downloading from the bank as an ofx file, as another way to do the same.
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Sat Jan 21, 2023 10:28 pm
ostroffjh wrote:Was the schedule created by creating a loan (with interest)
yes

ostroffjh wrote:Was the schedule created as part of creating a loan
yes

ostroffjh wrote:Are any of the transactions (before or after importing) split transactions?
yes

ostroffjh wrote:I'm trying to determine if the problem is with the total amount of the transaction, or with the amount(s) of specific splits.

Total amount of transactions is valid, and matches what the user is expecting prior and after import.

ostroffjh wrote:The scheduled transaction is only "virtual" until you explicitly enter it, at which point it becomes a real transaction, even if it appears in the ledger.

On the same page here. What I am trying to explain is that the upcoming payment shown by the "virtual" transaction, is showing as expected relative to the total payment and split into interest and to the loan payment. The reason I say this is because, the "virtual" transaction amount in the "payment from account ledger" (weekly payment), and the "payment to loan ledger" (spit transfer to loan) are matching the calculations from the bank. I see them as "virtual" or upcoming if you will in both accounts in KMM Ledgers.

ostroffjh wrote:When you import the transaction from the bank, I would not expect it to match to the existing transaction unless the amounts are the same, so there is something that doesn't make sense. In fact, you might try to import from the bank before you enter the scheduled transaction, so you can see exactly what the bank is sending. It might also be worth downloading from the bank as an ofx file, as another way to do the same.

OK so to be clear, the weekly loan payment including principal and interest is fixed, the program is matching it to the loan schedule (set-up when I opened the load account in KMM), and by that I mean when I import ofx into the bank account used to pay loan principal.

Here is the setup:
Chequing account to pay the loan.
Loan account set-up with the wizard to use chequing account above with specific quarterly variable interest rate and weekly payments etc...
In the chequing account, I import transactions weekly, one of the transactions matches the weekly loan payment as the user expected
After the match, the split to the loan account is paying 13 cents more on the principal than it should (consistently on every weekly payment) - HOWEVER, before the previous step (before importing OFX) I can see that the schedule is correctly calculating the "virtual" split amount.
Only after OFX import and matching, for whatever reason, the split amount does add 13 cents to the principal and remove 13 cents from the interest. Overall the total weekly payment is fixed, just the split allocation is not, and I wonder if it is due to a rate adjustment? But it never happened before with the rate adjustments so not sure if it is a user error or something else.

Apologies for being verbose.
User avatar
ostroffjh
Registered Member
Posts
253
Karma
0
OS

Re: Loan shedule vs actual issue

Sun Jan 22, 2023 12:07 am
I suggest that the next step is to check the amounts in the transaction imported from the bank. You can do this by downloading an OFX file from the bank instead of doing a direct connect, or you can turn on logging. The former may be easier. For the latter, see Settings/Configure KMyMoney, the General section, Support tab. If the download shows the expected amounts, we'll have to look deeper into exactly what KMM is doing to change them. If the download shows the amounts off by the $.13, then the task is to figure out why the bank's weekly statements seem not to match the table they provided when you secured the loan.
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Sun Jan 22, 2023 4:01 am
Thanks for the tip. I downloaded and looked at the OFX in notepad, the amounts are consistent with what the schedule has set and what the bank loan calls for in terms of periodic payments. So back to square 1 :(

I still need to get 5.1.3 to test but not sure where to find it for windows. I think Jenkins is involved, but I'll have to dig into some old thread where others helped get nightlies to troubleshoot another issue I encountered. In fact, I might have that nightly somewhere, I'll test it to see if it behaves the same on that build and report back. I have been keeping old copies of the .kmy since this started for troubleshooting purposes.

Anyway, I'm open to suggestions and can navigate my way through the XML if needed.

Appreciate your help.
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Sun Jan 22, 2023 4:35 am
On reflection, I did another test, where instead of importing, I just: Right Click->Enter Next transaction from the ledger and the split works perfectly.

Also the nightly I have is a 5.1.8 build without OFX importing, which is how I got the idea.

I'll do some more testing tomorrow.
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Loan shedule vs actual issue

Sun Jan 22, 2023 7:07 am
That is a very interesting problem. A bit of information upfront: the schedule contains three splits (just in case you look at the XML at some point) which reference your payment account, the interest category and the loan account. The amount on the first is the fixed amount for the payment and the others contain a special value which we internally refer to as autocalc. Whenever KMyMoney needs to use real values (that is for the preview in the ledger (those virtual things) or converting the schedule into a real payment) it performs the calculation based on the parameters attached to the loan (interest rate, current balance, due date and what not).

If I get this right, the data received from the bank is correct. OTOH, if you enter the schedule manually, the amounts are calculated correctly also, but if you import the OFX from the bank (which I assume has only the information about the amount withdrawn from the payment account and not the actual amounts for interest and principal) the calculated values for interest and principal are incorrect.

Another important piece of information in the calculation is the date. Can you check which date is shown for the virtual ledger entry (only makes sense when it is not overdue and in the future) or alternatively the date when you enter the schedule manually, the date shown in the OFX for the transaction and the one that is shown in the ledger for the incorrect transaction after the import happened.

Hope that gets us a bit further. Regarding 5.1 and an updated Windows version: the current nighty builds are known to have a problem with OFX so that might not help here.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Thu Jan 26, 2023 4:19 am
Update: Running the tests on 5.1.3-master-1671-windows-msvc2019_64 - same behavior as the 5.1.1 version I initially noticed the discrepancy on.

If I get this right, the data received from the bank is correct. OTOH, if you enter the schedule manually, the amounts are calculated correctly also, but if you import the OFX from the bank (which I assume has only the information about the amount withdrawn from the payment account and not the actual amounts for interest and principal) the calculated values for interest and principal are incorrect.
Yes

Another important piece of information in the calculation is the date. Can you check which date is shown for the virtual ledger entry (only makes sense when it is not overdue and in the future) or alternatively the date when you enter the schedule manually, the date shown in the OFX for the transaction and the one that is shown in the ledger for the incorrect transaction after the import happened.
Trying to understand the request, I will provide some answers based on my possibly confused understanding, but we can tweak the discussion as needed based on below:

Can you check which date is shown for the virtual ledger entry
The date in the virtual ledger is that of the expected payment date to the load, aka the periodic payment date as set up by the bank and set up in the loan wizard.

...or alternatively the date when you enter the schedule manually, the date shown in the OFX for the transaction and the one that is shown in the ledger for the incorrect transaction after the import happened.
If I'm understanding this request, from just looking at dates in the leger after entering the transaction manually, the dates match. In addition, in the chequing ledger (where loan payments are made from), the following is noted under the loan payment transaction after import:
Bank entry: (date of loan payment)
Your Entry: (date of loan payment)
Where (date of loan payment) is the expected date, is per bank loan parameters, and the loan in KMM, as well as the date in the virtual ledger and as verified in the OFX. To me it appears that all is happening on the same date as expected.

Hopefully, I properly answered the above. If not I can try again.

Not to side-track the above diagnostics exercise, but digging in the XML 2 things caught my eye:
Code: Select all
key="compoundingFrequency" value="1024"
key="interest-calculation" value="paymentReceived"

What does 1024 correspond to in months?
What other options are available for the 2nd KV pair?
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Loan shedule vs actual issue

Sat Jan 28, 2023 2:36 pm
tcpsorcerer wrote:Update: Running the tests on 5.1.3-master-1671-windows-msvc2019_64 - same behavior as the 5.1.1 version I initially noticed the discrepancy on.

If I get this right, the data received from the bank is correct. OTOH, if you enter the schedule manually, the amounts are calculated correctly also, but if you import the OFX from the bank (which I assume has only the information about the amount withdrawn from the payment account and not the actual amounts for interest and principal) the calculated values for interest and principal are incorrect.
Yes
So we (maybe more I) need to check if there is a difference between entering the schedule based on manual entry and OFX (or basically any other) import and maybe come up with more questions for you.

---8<--- partly removed for better readability ---8<---
If I'm understanding this request, from just looking at dates in the leger after entering the transaction manually, the dates match. In addition, in the chequing ledger (where loan payments are made from), the following is noted under the loan payment transaction after import:
Bank entry: (date of loan payment)
Your Entry: (date of loan payment)
Where (date of loan payment) is the expected date, is per bank loan parameters, and the loan in KMM, as well as the date in the virtual ledger and as verified in the OFX. To me it appears that all is happening on the same date as expected.

Hopefully, I properly answered the above. If not I can try again.
That was exactly the info I asked for. Since the distribution between principal and interest is based on date calculation I wanted to make sure that the difference is not caused by that.

Not to side-track the above diagnostics exercise, but digging in the XML 2 things caught my eye:
Code: Select all
key="compoundingFrequency" value="1024"
key="interest-calculation" value="paymentReceived"

What does 1024 correspond to in months?
What other options are available for the 2nd KV pair?

See compoundingFrequency and interest-calculation


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Loan shedule vs actual issue

Sat Jan 28, 2023 3:06 pm
One more thing to try in getting a grip on this one: Can you enter the schedule manually and then do the OFX import for the next iteration? The match should still happen, but I am wondering if the numbers will remain correct in the ledger. In any case, I would need some detailed information with your actual numbers to reproduce this here. From a first code analysis, both methods seem to use the same code to do the actual calculation. So the culprit must be in the data. Let me know, and we can discuss that on a more private channel.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Sat Jan 28, 2023 9:29 pm
Thanks, will provide more feedback soon. I am trying to eliminate suspicion of user error.
User avatar
tcpsorcerer
Registered Member
Posts
18
Karma
0
OS

Re: Loan shedule vs actual issue

Sat Jan 28, 2023 10:04 pm
Can you enter the schedule manually and then do the OFX import for the next iteration? The match should still happen, but I am wondering if the numbers will remain correct in the ledger.
Did this and the issue appears to persist.

After some testing, I initially thought I might have a lead, but it was not to be. Let me know which channel you'd like to converse on.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]