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

Quicken 2000 to KMyMoney migration

Tags: None
(comma "," separated)
OldJohnB
Registered Member
Posts
1
Karma
0
OS

Quicken 2000 to KMyMoney migration

Wed Oct 26, 2011 9:52 pm
I am not sure if this is the best place for this information but it may be useful to others migrating from Quicken 2000. I have been using Quicken for about 20 years and have large files of historical data. I usually archive my bank account files every few years but I find it useful to maintain all the historical investment account files for performance tracking.

i) First the successes. Exporting QIF files from Q2000 and importing them into KMM was straight forward and successful, except for some categories that were auto-generated by KMM as Income instead of Expense. This I assumed was due to KMM assuming that a positive $ transaction was Expense and a negative $ transaction was Income. However, I sometimes obtain refunds for purchases that I place into the Expense category where the original purchase was placed. I rectified this problem by editing the Category list after importing the data.

ii) Another minor problem was that Quicken treats investment accounts like banking accounts and does not use "brokerage accounts". Hence transfers from bank accounts to investment accounts were auto generated by KMM as bank accounts. This I corrected by creating KMM investment and brokerage account pairs of the same name and moving transaction from auto-gen accounts to the new brokerage account, and finally deleting the auto-gen account.

iii) Now we come to the first real problem area! KMM did not import the Q2000 QIF investment or security files correctly. The first problem seem to be that KMM requires all securities to have ticker symbols whereas Q2000 does not. I fixed this problem by writing a Python script to parse the QIF and add a sequence of arbitrary ticker symbols to all securities that did not have them.

Code: Select all
#!/usr/bin/python
import sys
import os.path

if len(sys.argv) != 3:
  print 'Number of arguments Error!\nTwo arguments required.\nparse_securities.py old_name.qif new_name.qif'
  sys.exit()
else:
  old_name = sys.argv[1]
  new_name = sys.argv[2]
try:
  curdir = os.getcwd() + '/'
  old_path = os.path.join(curdir, old_name)
  f = open(old_path, 'r')
except (IOError, os.error), why:
  print "Can't open file %s %s" % (`old_name`, str(why))

new_path = os.path.join(curdir, new_name)

try:
  out = open(new_path, 'w')
except (IOError, os.error), why:
  print "Can't open file %s %s" % (`new_name`, str(why))
out.truncate()
count = 0
price = 0
tic_count = 0
for line in f:
#  if line.strip('\n') == "!Type:Prices":
#    print line
  s = line.strip()
  if s == '!Type:Security':
    count = 1
    out.write(line)
    print line,
  elif count > 0:
    count += 1
    if (count == 3) and (s[0] != "S"):
      tic_count += 1
      ticker = "SD:TIC00" + str(tic_count)
      print ticker
      ticker = ticker + '\n'
      out.write(ticker)
    print line,
    out.write(line)
    if s == '^':
      count = 0
  elif (s == '!Type:Prices') or (price > 0):
    price = 1
#    print line,
    out.write(line)
    if s == '^':
      price = 0
     
 
f.close()
out.close()


iv) The second problem was with the investment QIF files. KMM did not import these files correctly because Q2000 does not insist on investment transactions having a category. Also KMM does not have a "reinvest interest" action just a "reinvest dividend". The following Python script I wrote to parse the QIF file and add categories where required and replace all "reinvest interest" with "reinvest dividend".

Code: Select all
#!/usr/bin/python
import sys
import os.path

def incexp(L, cat = 'inc' ):
  # for NDiv, NXIn, NMiscInc

  if L[2][0] != 'Y':
    for x in L:
      if x[0] == 'L':
   break
    else:
      if L[len(L) - 2][0] == '$':
   pos = len(L) - 2
      else:
   pos = len(L) - 1
      if cat == 'exp':
   L.insert(pos, 'Investment Exp')
      else:
   L.insert(pos, 'L[Undefined Source]')
 
def ndiv(L, cat = 'div'):
    for x in L:
      if x[0] == 'L':
   break
    else:
      if L[len(L) - 2][0] == '$':
   pos = len(L) - 2
      else:
   pos = len(L) - 1   
      if cat == 'div':
   L.insert(pos, 'LDividend')
      else:
   L.insert(pos, 'LInterest')
 


if len(sys.argv) != 3:
  print 'Number of arguments Error!\nTwo arguments required.\nparse_securities.py old_name.qif new_name.qif'
  sys.exit()
else:
  old_name = sys.argv[1]
  new_name = sys.argv[2]
try:
  curdir = os.getcwd() + '/'
  old_path = os.path.join(curdir, old_name)
  f = open(old_path, 'r')
except (IOError, os.error), why:
  print "Can't open file %s %s" % (`old_name`, str(why))

new_path = os.path.join(curdir, new_name)

try:
  out = open(new_path, 'w')
except (IOError, os.error), why:
  print "Can't open file %s %s" % (`new_name`, str(why))
out.truncate()

tx = []

for line in f:
  s = line.strip()
  tx.append(s)
  if s[0] == '^':
   
    if tx[1] == 'NReinvInt':
      tx[1] = 'NReinvDiv'
     
    elif tx[1] == 'NIntInc':
      ndiv( tx, 'int' )
     
    elif tx[1] == 'NDiv':
      ndiv(tx)
     
    elif tx[1] == 'NXIn':
      incexp(tx)
     
    elif (tx[1] == 'NMiscExp'):
      incexp(tx, 'exp')

    for x in tx:
      print x
      out.write( x + '\n' )
     
    del tx[:]
f.close()
out.close()


v) One more problem was that since Q2000 bank accounts are archived but not investment accounts there are transfers between archived accounts that don't show up in the bank QIF files. (Q2000 must handle this internally in some manner) My solution was to create a dummy bank account to which I transferred the balance of all historic transfers. This allowed the correct balance to be shown in the current bank account.


vi) Finally, after all these changes to 10 investment and 6 banking accounts for the family, I have a working system on KMM with all the correct balances. Unfortunately, I am unable to use KMM for my current needs since the KMM's reports are not yet up to the Q2000 standard and don't allow me to generate reports that show the information I need. At least I now know how to transfer my data so I await further development at KMM.

Sorry if my code is not as elegant as it might be. :)

John
aga
Registered Member
Posts
85
Karma
0
OS
Hi John

Glad you found your way through. I think your post and scripts should be OK here.

So far as your Reports issues are concerned, why not enter as wishlist items on bugs.kde.org ? They will stand a chance of acceptance when a developer has some time available.

Allan


aga, proud to be a member of KDE forums since 2008-Nov.
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS
Also, we have the contrib subdirectory in the source tree where we can store scripts like yours. Please add a header and some licence information (needs to be open source e.g. GPL) and simply send them to the developer list if you want that.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]