Improve stock handling in QIF import

Derek Atkins warlord@MIT.EDU
16 Feb 2001 20:47:35 -0500 (Bill Gribble) writes:

> On Fri, Feb 16, 2001 at 03:56:17PM -0500, Derek Atkins wrote:
> > I dont want to nuke my (empty) account tree.  But I'll go try your
> > new patch.
> Ok.  here it is.  This works for your case as close as I can simulate
> it here.  You should remove ~/.gnucash/qif-accounts-map before trying
> it.

You're right.  Except for a typo in gnc-commodity.c (gpoin4er?) your
patch does fix the problem for that case.  But as I was testing this
patch I found yet another case where the importer fails.  It's pretty
much the same symptom, except in reverse.

Start with a similar (but different) Gnucash account hierachy to what
I had earlier:

+-Assets (Asset)
|  +-Vanguard (Asset)
|     +-Treas MM (Bank, Security[Grey]="FUND:VMPXX (VMPXX)")
|     +-IT Tax-Ex (Mutual Fund, Security="FUND:VWITX (VWITX)")
|     +-500 Index (Mutual Fund, Security="FUND:VFINX (VFINX)")
+-Income (Income)
   +-Interest Income (Income)
      +-MA Tax-Ex Interest (Income)

Then load this QIF file (Treas55.QIF).  The account mappings are:

500 Index			-> Assets:Vanguard:500 Index
Dividends:Treas55:Treas MM	-> Income:Interest Income:MA Tax-Ex Interest
IT Tax-Ex			-> Assets:Vanguard:IT Tax-Ex
Treas55:Treas MM		-> Assets:Vanguard:Treas MM

Once you finalize the import, you'll have duplicate accounts for each
of the three Vanguard accounts!  The difference between Treas MM and
Treas MM 2 is that the latter is of type "Stock", IT Tax-Ex2 is of
type "Bank", and 500 Index 2 is of type "Bank".

Weird, huh?

Remember how I said earlier that 'Treas MM' really is a Mutual Fund
but I treat it like a Bank?  That's because the share value is always
$1.00.  Well, Vanguard, I guess, does still treat it like a fund, as
you can see from the QIF file below.  I suppose I could go back and
treat it like a fund instead of a Bank, but for some reason the
importer doesn't seem to like converting from one "fund" to another



YTreas MM
L[500 Index]
YTreas MM
L[IT Tax-Ex]
YTreas MM

       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL:    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available