[GNC] Adding Transactions From Another Program

Adrien Monteleone adrien.monteleone at lusfiber.net
Tue Apr 28 16:51:59 EDT 2020


My understanding is it isn’t exactly ’safe’ to directly edit the data file outside of the app. (this doesn’t mean you can’t, but don’t expect much support if something breaks or data is destroyed)

Since you are generating additional transactions, I’d just do that, in the form of a CSV file for GnuCash to import.

Do the import.

This won’t get your memos updated in the existing transactions.


-----
How often is the interest added to the account?

There is a feature to input interest charges when reconciling.

Scheduled Transactions also have the ability to use variables in formulas. You could write a formula for the interest calculation and schedule it as needed. This won’t auto-grab the existing balance, but if you use a variable for ‘current_balance’ GnuCash will prompt you for that figure to use in the formula. If the rate is also variable, then that too can be prompted.

Unfortunately, there is no ’template transaction’ feature. (yet) These would work like a Scheduled Transaction but instead fire on command as needed, not according to a set schedule. The best alternative is to schedule it for a reasonable time interval, but mark it not to be auto-created, but do opt for the notification it is due. That way, you can choose when to create the interest transaction, get prompted for the variable values, and then review the transaction before committing it.

Regards,
Adrien

> On Apr 28, 2020 w18d119, at 2:11 PM, Hal Vaughan <hal at hal.dance> wrote:
> 
> I’ve done some research on this issue and I’m trying to determine if it’s worth doing more or if I’d just spend time on this topic and find it won’t work.
> 
> I have a situation I’ve been told GnuCash can’t handle, but I have a Python library that can handle it.  (It has to do with calculating interest on a credit line with a variable balance.)
> 
> Years ago, I remember checking into GnuCash and reading the XML data files and finding that each transaction seemed to have a UUID with it, but that the other data in each entry would be easy to generate from my own library written in Python.  I also know that now the data files can be in SQL, using several different engines, and that if it’s an XML file, it’s in gzip format.
> 
> I do not need my program to run as a plug-in or anything like that.  (Last I looked, I had to install MacPorts for that, and last time I installed MacPorts, it made a mess of the libraries for my old Perl scripts and some Python ones.)
> 
> But here’s what I’d like to do:
> 1. Enter my transactions involving the credit line normally in GnuCash.
> 2. Exit GnuCash
> 3. Run my Python script that would read the GnuCash data file and find all transactions with any credit lines.
> 4. Do the interest calculations for my credit line
> 5. Add a debit transaction for the interest amount before each new transaction with the credit line
> 6. Edit the comment field for each transaction involving the credit line to include notes on interest and totals
> 7. Save the ledger and exit my library script.
> 8. Run GnuCash again and have the new transactions included and their amounts included in any account totals.
> 
> Is this even possible?  I don’t mind doing the research to find out how to generate a transaction ID and all the rest.  I just want to know if I can use my own library to add transactions to a file (or edit comments in a transaction) and, when I’m done, for GnuCash to be able to read that file, with my new transactions, in and to include the amounts in the added transactions in account totals.
> 
> 
> 
> Hal



More information about the gnucash-user mailing list