11.4. Configuring for Getting Quotes Periodically

The command gnucash-cli --quotes get ${HOME}/gnucash-filename [15] can be used to fetch the current quotes of your stocks and write them directly into your GnuCash-data file without starting the GUI. Thus an automatic, regular updating of the price database is possible.


The command will fail if it cannot get a lock on the data file, for example if the data file is open in another GnuCash instance or if the last session for the file crashed.

The file specified ${HOME}/gnucash-filename will depend on the name and location of your data file. This can be determined by the name displayed in the top frame of the GnuCash window, before the -.


The file name can also be found under File in the recently opened file list. If you place the mouse over the menu item with the number 1 in the list of recently opened files, the complete file name is displayed in the status bar.

You have to register the gnucash-cli with a scheduler in order to get Online Quotes automatically and periodically. The method depends on your OS.

Example 11.1. Automated quote retrieval every Friday at 4:00 p.m.

Procedure 11.8. On Linux and macOS

Register gnucash-cli with cron.

  1. Run crontab -e.

  2. Add the following line to your crontab:

    0 16 * * 5 gnucash-cli --quotes get ${HOME}/gnucash-filename > /dev/null 2>&1


    If there is no graphic session that has already started the dbus, running on your computer at the time of the quote request, you must do the entry as follows instead:

    0 16 * * 5 env `dbus-launch` sh -c 'trap "kill $DBUS_SESSION_BUS_PID" EXIT;
    gnucash-cli --quotes get ${HOME}/gnucash-filename > /dev/null 2>&1

    (Do not copy the line breaks into the crontab, they were inserted here only for the purpose of readability).

Procedure 11.9. On Windows

Register gnucash-cli with Task Scheduler.

  1. Select StartWindows Administrative ToolsTask Scheduler .

  2. Select Create Task.

  3. Enter the appropirate items on Create Task Window.

Adjust the time to the close of the stock exchange and consider fund quotes, that the net asset value (NAV) is determined well after the markets closed. The types have their description in Section 8.6, “Price Editor”.

Some users have made additions to the wiki and shared their experiences on the Online Quotes Page on GnuCash Wiki.

[15] The Online Quotes Retrieval command has been changed from GnuCash 4.0. The old command gnucash --add-price-quotes ${HOME}/gnucash-filename is still available, but it is deprecated and will be removed in the future release. If you've upgraded from GnuCash 3.11 or previous version, it is recommended to use the new command gnucash-cli.