Importing capital gains with QIF

Jeff Carneal jeff-ml at soldmy.net
Sat Feb 3 15:30:09 EST 2007


Hello all,

First let me say that I'm a recent convert after being stuck in  
Quicken hell for the past 8 years.  I can't tell you how much happier  
I am now that I've converted my stuff to gnucash.  I'll throw stones  
at single-entry accounting programs from now on :)

I'm also an OS X user / developer and I have compiled all the libs  
and gnucash from scratch in the hopes that I can create and  
distribute a .dmg to make it a lot easier for new mac users to  
install gnucash.  I may need some assistance on various aspects of  
that in the future, but for now on with my first question...

I imported 8 years worth of quicken data.  It didn't go perfectly, as  
I suspected, but it did go better than expected.  One thing that is  
missing, however, is the income from capital gains/losses I've had  
over the years.  The import seemed to pick up the capital gain  
distributions and throw those into income accounts, but I actually  
want to import the realized capital gains (per brokerage account and  
per stock) from years past as well.

Since the import process brought in all of my stock trades, I figure  
that the best way to import the capital gains would be to debit a  
particular stock account (on a 0 share transaction) and credit a  
corresponding capital gain income account.  For instance:

Assets:Stock:AAPL
	Shares: 0,	Total Buy:  500.00
Income:Capital Gains:AAPL
	Income:  500.00

This way the share balance is unaffected and I can simply enter one  
each of these type of transactions for every capital gain event I  
have in quicken.  Perhaps there is a better way to go about this  
(that does not involve reimporting all my other data).

With that in mind, I have created through quicken and various perl  
massaging a delimited file of the form (more or less):

Date : Security : Account : CG Gain or Loss

I can quickly and easily turn that into a QIF file of the form:

!Account
NAssets:Stock:AAPL
TInvst
^
!Type:Invst
D8/16' 4
NCGShortX
YAPPL
T500.00
L[Income:Capital Gains:AAPL]
^

Now, when I import this file, the importer script sees that we are  
transferring to an income account and therefore expects the original  
account (Assets:Stock:AAPL) to be an income account.  When it finds  
this is not the case (because it is a stock account) the script  
creates a new set of accounts like this:

Assets 2:Stock 2:AAPL2

So what I need is a way to either trick the importer into using the  
original account or perhaps a new method altogether.

Any help is appreciated and thanks to everyone who has contributed to  
this wonderful project.

Jeff



More information about the gnucash-user mailing list