Problem returned: stock sell showing up as payment

Thomas Baumgart thb at net-bembel.de
Sun Sep 4 16:21:20 BST 2022


On Sonntag, 4. September 2022 16:16:39 CEST Thomas Baumgart via KMyMoney-devel wrote:

> Jack,
> 
> On Mittwoch, 24. August 2022 22:02:52 CEST Jack via KMyMoney-devel wrote:
> 
> > On 2022.08.05 14:05, Jack via KMyMoney-devel wrote:
> > > 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).
> 
> I added this
> 
> commit 0ac7499605325a8ce7a8d4bd753a58ed23a9458c (HEAD -> master)
> Author: Thomas Baumgart <thb at net-bembel.de>
> Date:   Sun Sep 4 16:07:38 2022 +0200
> 
>     Added consistency check for differing sign detection
>     
>     This identifies when shares and value of a single split have different
>     signs. This can actually never be the case but apparently may happen.
>     This change should help to figure out when and why this may happen.
> 
> to master so that we eventually find out when it happens. The consistency
> check is run on each save of the file or manually by Tools/Consistency check.
> 
> Hopefully, we can nail this down somehow.

I also came across this part of the code which seems bit weird to me but
could have something to do with the problem we try to figure out:

    t.m_amount = MyMoneyMoney();
    if (data.amount_valid) {
        t.m_amount = MyMoneyMoney(data.amount, 1000);

        if (pofx->d->m_fixBuySellSignage) {
            if (t.m_eAction == eMyMoney::Transaction::Action::Buy
                    || t.m_eAction == eMyMoney::Transaction::Action::ReinvestDividend) {
                t.m_amount = -t.m_amount.abs();
                t.m_shares = t.m_shares.abs();
            }
            else if (t.m_eAction == eMyMoney::Transaction::Action::Sell) {
                t.m_amount = t.m_amount.abs();
                t.m_shares = -t.m_shares.abs();
            }
        }

        if (pofx->d->m_invertAmount) {
            t.m_amount = -t.m_amount;
        }
    }

m_fixBuySellSignage is controlled via the option at the bottom of the attached screenshot.
m_invertAmount is controlled via the option above it. Similar settings should exist
for mapped accounts via the online tab of the account editor.

https://invent.kde.org/office/kmymoney/-/commit/50da0c1a shows the commit that introduced
that fixBuySellSignage option.

Does that make sense/a difference? What are your settings?

-- 

Regards

Thomas Baumgart

-------------------------------------------------------------
Ein Sysadmin schläft nicht ...
... er root.
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ofximportoptions.png
Type: image/png
Size: 24336 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20220904/590500d7/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20220904/590500d7/attachment-0001.sig>


More information about the KMyMoney-devel mailing list