On 2022.08.03 10:19, Jack via KMyMoney-devel wrote:
On 8/3/22 02:03, Thomas Baumgart via KMyMoney-devel wrote:
On Mittwoch, 3. August 2022 01:40:50 CEST Jack via KMyMoney-devel
wrote:
I just looked at on of my investment account to reconcile the new
statement, and the brokerage account has a large negative balance.
Without doing a full audit, it appears that two stock sell
transactions (for the same security) last month are showing up in
the brokerage account as Payments instead of Deposits. I'm know I
did a proper reconciliation last month, but now those numbers don't
match. I have not yet gone through all my saved copies to see when
it changed, but that's next on my list.
Just in case anyone has any ideas, one of the transactions is
below. I've trimmed the memo of lots of excess details Merrill
Lynch includes, and I trimmed the bankid.
<TRANSACTION commodity="USD" entrydate="2022-07-02"
id="T000000000000025879" memo="Sale: PUTNAM ULTRA SHORT DURATION
INCOME
FD..." postdate="2022-06-15">
<SPLITS>
<SPLIT account="A000345" action="" bankid="" id="S0001"
memo="Sale: PUTNAM ULTRA SHORT DURATION INCOME FD..." number=""
payee="" price="1/1" reconciledate="2022-06-30" reconcileflag="2"
shares="-55723/50" value="-55723/50"/>
<SPLIT account="A000941" action="Buy" bankid="ID 20220614..."
id="S0002" memo="Sale: PUTNAM ULTRA SHORT DURATION INCOME FD..."
number="" payee="" price="-10/1" reconciledate="2022-06-30"
reconcileflag="2" shares="-55723/500" value="55723/50"/>
</SPLITS>
</TRANSACTION>
Account 345 is the brokerage account and 941 is the stock account
within the investment account.
Looks like
shares="-55723/500" value="55723/50"
is probably the source of the problem. That is simply wrong and may
be caused by some bug. Somewhere, the split of the brokerage account
(S0001) is created based on the value part of the security split
(S0002) by simply inverting the value. Since value in S0001 has the
wrong sign you see those results. It could well be that this is
still a problem within the investment transaction editor (which is
the new kid on the block here).
One thing which caught my eye is that the split for the security
has 'action="Buy"' which worried me more before I noticed that it
has that value for lots of transactions other then stock sales.
Might that be an issue, or is it likely a red herring?
Within the XML file, the action string is always presented as "buy"
and the sign of the split controls if it is actually a buy or a sell
operation. The conversions happen in
MyMoneySplit::investmentTransactionType and MyMoneySplit::setAction.
So that is not a problem.
I'll post more when I have a tighter window on when the problem
started.
Did you enter the transactions manually or did you import them and
edited them afterwards?
First, on history, I have a backup on 7/2 prior to the creation of
that transaction. My next backup was 7/27, which shows the problem.
I had hoped to have a backup after the import and before the
reconciliation. I was going to say I'm sure the problem was
introduced after 7/2, but the actual earliest possible date would be
closer to the beginning of June, when I did my prior large import
from Merrill Lynch.
I'm pretty sure that was an imported transaction, and I do not
remember having to edit it, as I do with many other Merrill Lynch
transactions. However, I am quite sure I was using git master when I
did that import.
Also note that the sign is reversed for only two transactions, both
selling the same security, several days apart. There are plenty of
other sell transactions in that same account which are correct.
Would it help for me to test importing that account again for June?
I suppose I can download those transactions as OFX, if file import
would give the same values as direct connect. That way, I can test
several times, without repeatedly going back to the server.
Curiouser and curiouser. I downloaded an OFX file for all investment
transaction for that account for that month. Importing it into my
current file said 22 matches and 2 added transaction. Rhe ledger for
the brokerage account shows that the new transactions identical to the
two above problem transactions but shown (correctly) as deposits
instead of payments. However, those transactions are nowhere to be
seen in the Investment account. If I use the context menu to go the
the investment account from one of the new transactions, it takes me to
the old transaction.
Additional issue - the new transactions are not for the same security.
KMM creates new security accounts using something it extracts from the
downloaded transaction, and for Merrill Lynch, in includes lots of
extraneous stuff, such as date and/or price. When I edit the
transaction and change the security to the account name I use, the
transaction now shows up properly in the Investment account. However,
when I use the context menu to switch between the Investment and
Brokerage accounts, all is correct going from Investment to Brokerage,
but going the other way, both the old and new transaction take me to
the old one.
Then, deleting both old (wrong) transactions, and marking the new ones
as reconciled, everything is back to normal - so I can continue with my
daily use of the files. I also now have enough backups that I can at
least partly recreate some of these problems. However, given that the
current git master imports correctly, I suppose I have to assume it was
a transient issue, so there's no real point in trying to track down the
exact cause. However, I'll be glad to do further testing if anyone
thinks it would be useful.
Separate note: At some point during this process, I actually found a
few transactions which were marked "R" for reconciled, but were also
still marked as Imported. These were all rather old transactions, and
I can only assume that marking them Cleared at the time did not also
clear the Imported marking. This is with git master (KMyMoney Version
5.1.80-932e4a272) so I don't know how it relates to bug 457484
(https://bugs.kde.org/show_bug.cgi?id=457484) which is with 5.1.2.
Jack