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

Unable to Close An Equity

Tags: None
(comma "," separated)
rblackwell
Registered Member
Posts
124
Karma
0
OS

Unable to Close An Equity

Sat Dec 28, 2019 5:13 pm
Running KMyMoney Version 5.0.80-e529e3124 on Windows 10.

I have two investment accounts, one named RRSP the other named TFSA. Each has its own Equities assigned. Recently I sold all shares for equities in each of the accounts. The balance for both sold equities are zero. I've been able to close one of the equities using the "Close Account" option but not he other. Under the "Equities" tab of the "Investments" window the equity appears with a zero balance, no shares. Unlike the other equity, I'm unable to select "Close" from the "Accounts" menu. The option is grayed out. I've read through a number of past posts about similar situations. I've not found anything that address the situation I'm facing.

In an attempt to resolve the problem all entries in the Investment account have been reviewed to ensure dollar values entered at the time of transaction were correct. No errors were found. I'm using "Total for all shares" for the funds although I recall that I may have changed to that setting following a few entries after initial shares of the equity were purchased. From what I've read, this seems to be a rounding error however i cannot figure out how to overcome the problem.

Any guidance on how to close the equity and remove it from the Investment account would be appreciated?
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Unable to Close An Equity

Sat Dec 28, 2019 7:49 pm
I could imagine that due to a rounding problem the balance shows as zero but it might technically be a bit off by some fraction. Since you run on master you should have access to the source code. The contrib directory contains a script called getsplitpart.pl which can extract the amount of each transaction for a given account. The synopsis is

getsplitpart.pl --acc=xxxx --field=yyyy

xxxx needs to be the account id of the account you look for. yyyy is the field name. In your case it seems to be shares. The output is a CSV data stream you can read using your favorite spread sheet program. So do

zcat your-data-file.kmy | ./getsplitpart.pl --acc=A000003 --field=shares

to see the output. Use I/O redirection to store the data in a file. Here's some sample output:

Code: Select all
transactionId;splitId;shares;amount
T000000000000000002;;1288/5;257.6
T000000000000000020;A000003-2016-01-04-b51b670-1;1949/10;194.9
T000000000000000061;A000003-2016-01-25-226c5b0-1;-11591/100;-115.91
Of course you have to determine the right id for your account. One idea is to run

zgrep "name of your account" your-data-file.kmy

to extract the id from the XML. If you load the data in your file, does the sum of the amount column adds up to zero?


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

Re: Unable to Close An Equity

Sun Dec 29, 2019 1:05 am
ipwizard wrote:I could imagine that due to a rounding problem the balance shows as zero but it might technically be a bit off by some fraction. Since you run on master you should have access to the source code. The contrib directory contains a script called getsplitpart.pl which can extract the amount of each transaction for a given account. The synopsis is

getsplitpart.pl --acc=xxxx --field=yyyy

xxxx needs to be the account id of the account you look for. yyyy is the field name. In your case it seems to be shares. The output is a CSV data stream you can read using your favorite spread sheet program. So do

zcat your-data-file.kmy | ./getsplitpart.pl --acc=A000003 --field=shares

to see the output. Use I/O redirection to store the data in a file. Here's some sample output:

Code: Select all
transactionId;splitId;shares;amount
T000000000000000002;;1288/5;257.6
T000000000000000020;A000003-2016-01-04-b51b670-1;1949/10;194.9
T000000000000000061;A000003-2016-01-25-226c5b0-1;-11591/100;-115.91
Of course you have to determine the right id for your account. One idea is to run

zgrep "name of your account" your-data-file.kmy

to extract the id from the XML. If you load the data in your file, does the sum of the amount column adds up to zero?


Hi Ipwizard,

Thank you for the feedback. I found a previous post detailing the same information you have here. Problem is, I'm running on Windows, not Linux. I installed perl and attempted to extract the data by first unzip My-Money-file to a new directory then running the perl script on the extracted file using the command;

Code: Select all
PRINT | getsplitpart.pl --acc=[b]xxxx[/b] --field=[b]yyyy[/b]  > output.csv

This created an output file but no records were contained in the file.

Are you aware of Windows commands that can be used to extract the data?
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Unable to Close An Equity  Topic is solved

Sun Dec 29, 2019 8:00 am
Not sure what the PRINT stands for in your example, but it seems a bit strange to me. Did you try
Code: Select all
getsplitpart.pl --acc=xxxx --field=shares  > output.csv < your-data-file.xml
Just like you do output-redirection you can do input-redirection.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
rblackwell
Registered Member
Posts
124
Karma
0
OS
ipwizard wrote:Not sure what the PRINT stands for in your example, but it seems a bit strange to me. Did you try
Code: Select all
getsplitpart.pl --acc=xxxx --field=shares  > output.csv < your-data-file.xml
Just like you do output-redirection you can do input-redirection.


Thank you, ipwizard. I FOUND THE PROBLEM!

I made two mistakes in my approach. First was that I initially looked up the wrong acc ID. Rather than searching for transactions using the ID of the investment, I was searching the investment account. Once I realized this, I used your approach to search for and analyze the entries. I was expecting to find a rounding error. The output of the perl script provided a clue in the transaction numbers. One transaction had a reference number of SCH000129. This lead me to review the scheduled transaction list. Here I found a scheduled transaction for the Investment I could not close the account on. Once the scheduled transaction was removed, I was able to close the account. Problem solved!


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], lockheed