Getting Ameritrade data into gnucash

David Reiser dbreiser at earthlink.net
Fri Apr 22 16:07:38 EDT 2005


On Apr 22, 2005, at 11:39 AM, Jean-David Beyer wrote:
[much snipped...]
> The main trouble is the
> downloading of my transactions in my American Express account and my
> Ameritrade (stock brokerage) accounts.

I don't know about American Express (and I never expect to even try...) 
but with regard to downloading Ameritrade investment account data, 
there is  a python script, ofx.py, available from 
http://www.jongsma.org/gc/scripts/ofx.py that will get the last 30 or 
31 days of data from your account onto your computer as, not 
surprisingly, an ofx data file. That file can be imported directly into 
Gnucash.

Once you have the script, you can issue the command:

python ofx.py ameritrade 987654321 987654321

where the two numbers are your nine digit account number. You do need 
to enter it twice, because the ameritrade server uses one of them as 
your userID and one as your accountID -- and it insists that both be 
present on their own.

When the script responds with "Password:", type in your account PIN 
(the one assigned as your telephone response system PIN).

After thinking for a while, the system sends you a file like: 
ameritrade20050422.ofx. That file can be imported into gnucash
using File/Import OFX-QFX menu item in gnucash.

Notice that none of your access control information for the download is 
the same as the web login security information (at least by default, 
you can change your web login stuff via a browser to match, but I don't 
recommend it.)

Ameritrade appears to send the most recent 30 (possibly 31) days of 
data -- always. That's no big deal, unless you have lots of 
transactions and download often. Once you get beyond 20 or so 
transactions, the import process in Gnucash slows way down. The script 
source suggests there is a parameter for setting the start date for the 
data set, but I've not been able to get that to work with ameritrade.

One thing that will go wrong is that dividend payments from individual 
stocks will be imported unbalanced. The import module handles mutual 
fund dividends (the ones that get automatically reinvested) correctly, 
but the individual stock dividends that result in a cash increase in 
your account will be handled incorrectly. I think the fastest approach 
is to let the importer import the transaction unbalanced, then go into 
the account register and cut and paste the amount from the wrong column 
into the correct one.

Dave






More information about the gnucash-user mailing list