📜 ⬆️ ⬇️

Integrating GnuCash with Internet banks using OFX emulator

I love GnuCash, this is the only free financial accounting program that has approached me 100%. GnuCash can integrate with multiple banking applications through multiple interfaces. However, unfortunately, our banks do not seem to be implementing at least one of them.

My project is designed for those who are tired of every time to climb in IB, to check the balance and reconcile transactions GnuCash. I present to you the first version of the free Open Financial Exchange protocol emulator.

Attention, there are many images inside the article.

Immediately say that the project was written for personal use. At the moment, it only supports Avangard Bank. Soon I will be implementing a plugin for the Russian Standard Bank. I hope that someone will write a plugin for their bank and the project will develop.
The specifics of the emulator does not allow you to create one site for all users due to the fact that hardly anyone would want his passwords from the Internet bank to be available to such a service. I think the best solution would be to install an emulator on your server or computer with GnuCash.

Emulator setup

To set up an emulator, you need to copy its source code from the GitHub project repository to your server. GitHub has a Download Source button for downloading to zip / tar.

The setting is to change the configuration file config.ini:

log.file = "../../ofx.log"

user.password = ""
cookie.file = "../../avangard.cookie.txt"

user.password is an encrypted IB password. In order to get it, you must use the function to generate a password function cryptPassword ($ user, $ password, $ fish), in the includes folder the file lib.crypt.php.

This is necessary so that your password is not stored in clear text on the server:

echo cryptPassword(" ", " ", " GnuCash");

GnuCash setup

The GnuCash program has a standard feature for integrating with banking systems through the OFX protocol. The Setup Wizard is located in the Tools menu and is called Online Banking Setup.

First you need to create an IB user.


User Id and Customer Id for Avangard plugin - login IB.

After that, you need to configure OFX:


As a server url, you need to set the address to your copy of the emulator, namely to the file ofx.php.

AVANGARD plugin allows you to automatically get a list of all accounts, so put a tick "Support Accounts List Download" and click GetAccounts. After entering the pincode, if everything is configured correctly, you will receive a list of all your accounts. Now click OK and link our accounts to GnuCash:


Everything. Now you can use the “Get Balance” option in the “Online Actions” menu:


I invite everyone to participate in the project and add plug-ins for your online bank.

Project website: ofx.sharecoder.com

Source: https://habr.com/ru/post/103669/

All Articles