On 2025.06.09 06:21, Thomas Baumgart via KMyMoney-devel wrote:
On Montag, 2. Juni 2025 01:47:52 CEST Jack Ostroff via KMyMoney-devel
wrote:
> I have an investment transaction imported by OFX, and KMM crashes
with
> a Floating point exception when I try to open the account in the
ledger.
>
> [below lines manually wrapped and memos and some other fields
shortened
> for readability.]
>
> From the kmm-statement file for the ofx import:
> <TRANSACTION payee="" amount="2/1" brokerageaccount="" number=""
> action="sell" bankid="ID 20250519CA210057180306067"
> price="0/1" security="ALTABA INC" memo="Exchange: ALTABA INC
CASH
> MERGER" reconcile="0" securityId="021ESC017"
> dateposted="2025-05-19" shares="0/1" fees="0/1"/>
>
> This imported as
> <TRANSACTION id="T000000000000034673" postdate="2025-05-19"
> memo="Exchange: ALTABA INC CASH MERGER" entrydate="2025-05-31"
> commodity="USD">
> <SPLITS>
> <SPLIT id="S0001" payee="" reconciledate="" action=""
> reconcileflag="0" value="2/1" shares="2/1" price="0/1"
> memo="Exchange: ALTABA INC CASH MERGER" account="A000345"
> number="" bankid=""/>
> <SPLIT id="S0002" payee="" reconciledate="" action="Buy"
> reconcileflag="0" value="2/1" shares="0/1" price="0/1"
> memo="Exchange: ALTABA INC CASH MERGER" account="A000722"
> number="" bankid="ID 20250519CA210057180306067"/>
> </SPLITS>
> <KEYVALUEPAIRS>
> <PAIR key="Imported" value="true"/>
> </KEYVALUEPAIRS>
> </TRANSACTION>
>
> "Show transaction details" shows the price in both splits as 1, not
0
>
> Clearly this is a strange transaction, since the UI won't let me
create
> a buy/sell for 0 shares. I have no idea why Merrill Lynch calls
this a
> sell, as it appears to just be some sort of dividend or other
payout of
> $2.00.
>
> My assumption is there is a divide by zero, but I can't be sure
until I
> trace through the code. If nothing else, shouldn't this type of
error
> get trapped and reported instead of crashing?
Here's a fix to get around the division by zero problem:
https://invent.kde.org/office/kmymoney/-/commit/cb810055443cdb5a8dabeb3f87da36b826a8080f
So this has an effect on import, not once the "bad" data is already
imported. I deleted the original and reimported, and it does convert
to an interest transaction. I suppose that's the best we can do here.
I apparently already had a category called "exchange" which I used
instead of "interest" but that's a personal choice. Some day I may try
to dig at Merrill Lynch, but they have historically been totally unable
to provide any real technical assistance related to their OFX
activities.
Thanks for the fix.
Jack