# Setting up the Quote update

If you have more than a couple of commodities, you will tire of having to update their quotes constantly. &app; has the ability to automatically download the most recent quote for your commodities using the Internet. This is accomplished through the &app-perl; module &app-fq;, which must be installed in order to activate this feature.

## Prerequisites for an Online Quote update with &app-fq; are

- the &app-perl; language interpreter and

- the &app-perl;-module &app-fq; with any dependencies.

If you get stuck while performing the steps described here, you can reach many helpful users on the channels mentioned under more_help.

You can also leave out this step and manually update your stock quotes.

## Installing &app-perl;

The installation of &app-perl; is essentially dependent on the operating system used. The effort for installation is low and is described in this section.

To check if &app-perl; is already installed on your system, call the command

    perl -v

in the terminal. If you are shown the version number of the &app-perl; interpreter, then continue with finance-quote-install.

## On &lin;

1. On most systems &app-perl; is probably already installed. If with the previous command does not show a version, then the easiest way is to use your system’s package manager for installation.

2. When using the &app; &flatpak; package, &app-perl; and &app-fq; are already functionally installed.

## On &mac;

1. &app-perl; is normally already set up under &mac;.

## On &win;

1. Under &win; run the program Start &appname; Install Online Price Retrieval to run. This will install Strawberry Perl.

   &app; Version 2.2.6 and before require ActivePerl. in version 5.8.

   &app; Version 2.4 and before require ActivePerl Version 5.16.3 and later.

2. For execution you need Administrator privilegies, which are requested in the dialog. The installation can take more then 15 minutes.

3. If during the installation the error message `No such file or directory` or `permission denied` are displayed, then it may help to disable the antivirus software temporarily.

## Installing &app-fq;

To determine if the &app-perl; module &app-fq; is already installed on your system, type `perldoc Finance::Quote` in a terminal window and check to see if there is any documentation

    NAME
        Finance::Quote - Get stock and mutual fund quotes from various exchanges

    SYNOPSIS
           [...]

available. If you are now shown documentation, then &app-fq; is already installed and you can configure periodical quotes update as described in finance-quote-scheduler. If no documentation is displayed, you will have to continue with this chapter.

The process of installing &app-fq; depends on the system. For the different supported systems, you can follow the instructions below:

## On &lin;

1. Close &app;.

2. Run the `gnc-fq-check` command to verify that the program is already in a directory that is entered in the PATH environment variable.

   If you’ve installed &app; packages provided by your distribution, `gnc-fq-check` must be on your PATH. The currentness of your distribution can be checked under &app-fq;- versions.

   If `gnc-fq-check` is not in your PATH, perhaps because you built the application yourself using unusual paths, search the folder where &app; is installed, e.g. with the command `which gnc-fq-check`, and change to that directory. It is a good idea to include the current directory in the PATH environment variable. Please refer to the documentation for your distribution for more information.

3. Next, update with `sudo gnc-fq-update` or `su -c gnc-fq-update` with root privileges &app-fq; It depends on your distribution.

   This will launch a &app-perl; CPAN

   See CPAN Frequently Asked Questions for details.

   module internally. When you launch the CPAN module for the first time, you must setup and configure it. However, on the most systems if you accept the default settings or answer the first question `Are you ready for manual configuration? [yes]` with `no`, you will be able to install &app-fq; successfully.

4. Run `gnc-fq-dump` to check &app-fq; works properly. This program returns the version number of &app-fq; module currently installed as well as a list of sources available via the &app-fq; module. It will also inform you if there is a problem with your installation or if it is missing, and may suggest a fix.

## On &mac;

1. Close &app;.

2. Install Xcode if it is not installed.

   XCode is an optional item from your &mac; distribution DVD.

3. Run the Update Finance Quote app in the &app; dmg.

   You can run it from the dmg or copy it to the same folder to which you copied &app;. It will open a Terminal window and run a script for you which will ask lots of questions. Accept the default for each unless you know what you’re doing.

## On &win;

1. Close &app;.

2. Run Start &appname; Install Online Price Retrieval . This is a small utility that installs &app-fq; for you.

## Configuring for Getting Quotes Periodically

The command `gnucash-cli --quotes get &user-datafile;`

The Online Quotes Retrieval command has been changed from &app; 4.0. The old command `gnucash --add-price-quotes &user-datafile;` is still available, but it is deprecated and will be removed in the future release. If you've upgraded from &app; 3.11 or previous version, it is recommended to use the new command `gnucash-cli`.

can be used to fetch the current quotes of your stocks and write them directly into your &app;-data file without starting the GUI. Thus an automatic, regular updating of the price database is possible.

Please note that the data file should not be open in another instance of &app; at the same time!

The file specified &user-datafile; 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 &app; 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.

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

### On &lin; and &mac;

Register `gnucash-cli` with cron.

1. Run `crontab -e`.

2. Add the following line to your crontab:

       0 16 * * 5 gnucash-cli --quotes get &user-datafile; > /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 &user-datafile; > /dev/null 2>&1

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

### On &win;

Register `gnucash-cli` with Task Scheduler.

1. Select Start Windows Administrative Tools Task 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 tool-price.

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