How to format QIF transaction for cash dividend to show up in Advanced Portfolio?

Timothy Byrd timothy at roseharp.com
Sat Feb 11 17:41:32 EST 2012


(Summary: How can I format a QIF transaction for a cash dividend so
the dividend shows up in the Advanced Portfolio Report?)

I'm starting with GnuCash, and one of the things I'd like to do is
track investment performance.

I have years of transactions I would like to import. My broker only
lets me download a CSV file. That's okay because I can write a Ruby
filter to convert it to a QIF.

It mostly works, but I cannot figure out how to format the QIF for the
cash dividends.

For a given stock - using MCD as an example - I have these accounts:

    Assets:Investments:Brokerage:MCD
    Income:Dividends:Assets:Investments:Brokerage:MCD

I have only been able to get the transactions to go straight from the
Income:...:MCD account to the Brokerage cash account, not touching the
Assets:...:MCD account at all.

That means the cash dividends do not show up in the Income column of
the Advanced Portfolio Report. Which makes that report pretty much
useless for income stocks.

To show what I have tried, import the following QIF into a newly
created GnuCash file:

****************

!Account
NAssets:Investments:Brokerage
TInvst
^
!Type:Invst
D10/7/2003
NBuy
YMCD
Q100
T2436.00
O7.00
MBought 100 shares of MCD at $24.29
^
!Type:Invst
D3/17/2008
NDiv
YMCD
L[Assets:Investments:Brokerage:MCD]
T30.00
MMCD Dividend of $30.00
^
!Type:Invst
D3/17/2009
NDivX
YMCD
L[Assets:Investments:Brokerage:MCD]
T35.00
MMCD Dividend of $35.00
^
!Type:Invst
D3/17/2010
NDivX
YMCD
L[Assets:Investments:Brokerage:MCD]
T0.00
MMCD Dividend of $37.50
$37.50
S[Assets:Investments:Brokerage]
EMCD Dividend of $37.50 (Split1)
$0
S[Assets:Investments:Brokerage:MCD]
EMCD Dividend of $37.50 (Split2)
I1
$37.50
S[Income:Dividends:Assets:Investments:Brokerage:MCD]
EMCD Dividend of $37.50 (Split3)
^

****************

The Advanced Portfolio Report doesn't have the income at all correct.
(Yes, there are other issues because no stock price is set, but we
only care about the dividends right now.) The $35.00 only appears
under Income because the second dividend transaction comes in as a
purchase of 35 shares at $1.00.

While searching for an answer, I found these two threads:

Advanced Portfolio and dividend in cash
http://lists.gnucash.org/pipermail/gnucash-user/2009-May/029783.html

QIF importer treatment of zero-sum split transactions
http://lists.gnucash.org/pipermail/gnucash-devel/2008-January/022111.html

The first thread has a link to a bug about this that got closed
because there is a hack that - if the transaction is entered in the
exact account, with the splits in the exact order - fools GnuCash into
accepting a zero-total transaction.

The second thread seems to say that anyone who uses that hack is a
moron. (Or maybe anyone who wants a cash dividend associated with the
stock that generated it is a moron?)

The last transaction in the QIF above is my attempt to implement the
hack, but it just generates two empty transactions.

So how can I format a QIF transaction for a cash dividend so the
dividend shows up in the Income column of the Advanced Portfolio
Report after importing the QIF file?

Is there some other alternative to entering hundreds of transactions by hand?

Thanks,

--- Timothy


More information about the gnucash-user mailing list