[GNC] How to bulk import about 130 Securities entries?

Kalpesh Patel kalpesh.patel at usa.net
Sun Aug 14 20:34:26 EDT 2022


Jim,

 

Not sure if anyone has mentioned or not but see if your broker provides
transactions in OFX format instead of CSV. With CSV I imagine that you will
have to perform some pre-processing before importing into GNC.

 

You will have much better success in minimizing import clicks and errors
with importation.

 

 

------------------------------

 

Message: 8

Date: Sat, 13 Aug 2022 18:28:22 -0700

From: Jim DeLaHunt <list+gnucash at jdlh.com <mailto:list+gnucash at jdlh.com> >

To: Gnucash Users <gnucash-user at gnucash.org
<mailto:gnucash-user at gnucash.org> >

Subject: [GNC] How to bulk import about 130 Securities entries?

Message-ID: <c70b6819-fef8-511e-28ac-350b49e3b8b8 at jdlh.com
<mailto:c70b6819-fef8-511e-28ac-350b49e3b8b8 at jdlh.com> >

Content-Type: text/plain; charset=UTF-8; format=flowed

 

Hello, folks:

 

I am a long-time GnuCash user, and for all those years I have pretty 

much not attempted to track my investments in GnuCash. But now I want to 

start.? My first goal is to import many years of past activity.

 

I have downloaded the transactions from my brokerage account as a CSV 

file. The first thing I get out of this is the name and symbol of about 

130 securities. I am wondering if there is a practical way to bulk 

import these into GnuCash. That is, instead of visiting Tools -- 

Security Editor, and pressing the Add button 130 times, and filling out 

the "New security" dialogue 130 times, is there a more efficient path?

 

Looking at the File? Import menu, I do not see an option to import 

Securities. Looking at the documentation, wiki, and list archives, I 

don't see a mention of this. Is there some bulk import mechanism I am 

overlooking?

 

I took a look at the uncompressed XML contents of a new, simple .gnucash 

book file. It appears that the data entered in the "New security" 

dialogue gets stored as <gnc:commodity> entities. There appears to be a 

pretty simple relationship between the fields of the dialogue and the 

text within the <gnc:commodity> entity. The entities are stored in a 

certain order, sorted by <cmdty:space> then <cmdty:id>. There is a 

<gnc:count-data cd:type="commodity"> entity which seems to contain a 

text count of the non-CURRENCY gnc:commodity entries.

 

This makes me wonder if I could transform my list of 130 security names 

and symbols into <gnc:commodity> entities, and insert them into the 

GnuCash XML of my book.

 

Are there complexities or pitfalls about this approach which I might be 

overlooking?? We can certainly stipulate that manipulating the XML 

content directly is unsupported and risky, I must be careful and keep 

backups, I might blow off my fingers, etc.? For what it's worth, I 

believe that I am pretty proficient with editing XML, processing CSV 

files, and scripting manipulations of text data.

 

Once I have the securities added to the book, I then need to add the 

appropriate child accounts to my brokerage accounts, each denominated in 

the appropriate security type and symbol. It looks like that is 

straightforward to do with a CSV of accounts in the correct format, and 

the File? Import?? Import Accounts from CSV? menu item. I have a few 

child accounts which I entered from the UI which will serve as 

examples.? Is there any way in which this is more difficult than it looks?

 

Cheers,

???? ?Jim "ADBE ALNIX AOL ? VUG VWO ZTD81" DeLaHunt

 

 

 

------------------------------

 



More information about the gnucash-user mailing list