Difference between revisions of "Online Quotes"

From GnuCash
Jump to: navigation, search
(Abstract)
(Requirements: trunk->master)
Line 1: Line 1:
 
[[GnuCash]] can update your price database by fetching quotes online via the [http://en.wikipedia.org/wiki/Perl Perl] module [http://finance-quote.sourceforge.net/ Finance::Quote].
 
[[GnuCash]] can update your price database by fetching quotes online via the [http://en.wikipedia.org/wiki/Perl Perl] module [http://finance-quote.sourceforge.net/ Finance::Quote].
 
==Requirements==
 
==Requirements==
You need to install several Perl modules in order to get online quotes. While the error message may be about Finance::Quote not being installed properly, that module alone is not sufficient. If it has been installed on your system, the script ''gnc-fq-update ''may be used to install the modules needed. If it has not been installed on your system, you can download it from [https://raw.github.com/Gnucash/gnucash/trunk/src/quotes/gnc-fq-update.in].  A discussion of how to set it up (in Ubuntu) can be found at [http://gnucash.1415818.n4.nabble.com/Installing-activeperl-for-automatic-retrieval-of-quotes-td4656798.html].
+
===Perl===
 +
===Finance::Quote===
 +
You need to install several Perl modules in order to get online quotes. While the error message may be about Finance::Quote not being installed properly, that module alone is not sufficient. If it has been installed on your system, the script ''gnc-fq-update ''may be used to install the modules needed. If it has not been installed on your system, you can download it from [https://raw.github.com/Gnucash/gnucash/master/src/quotes/gnc-fq-update.in].  A discussion of how to set it up (in Ubuntu) can be found at [http://gnucash.1415818.n4.nabble.com/Installing-activeperl-for-automatic-retrieval-of-quotes-td4656798.html].
  
 
That script, as of 2.4.0, uses CPAN to install:
 
That script, as of 2.4.0, uses CPAN to install:

Revision as of 22:09, 20 February 2014

GnuCash can update your price database by fetching quotes online via the Perl module Finance::Quote.

Requirements

Perl

Finance::Quote

You need to install several Perl modules in order to get online quotes. While the error message may be about Finance::Quote not being installed properly, that module alone is not sufficient. If it has been installed on your system, the script gnc-fq-update may be used to install the modules needed. If it has not been installed on your system, you can download it from [1]. A discussion of how to set it up (in Ubuntu) can be found at [2].

That script, as of 2.4.0, uses CPAN to install:

  • LWP
  • Date::Manip
  • HTML::Parser
  • HTML::TableExtract
  • Crypt::SSLeay
  • Finance::Quote

Then read the instructions.

Warning About Open Files

Updating quotes will modify the GNUCash file/database. As multi-user access is not supported (as of 2.4), the file/database should be closed prior to updating quotes.

cron and Non-X Usage

If you attempt to run

gnucash --add-price-quotes /path/to/file.gnucash

without dbus running (for example, from a cron job or ssh without X forwarding), you may get errors such as

GConf Error: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. 
See http://projects.gnome.org/gconf/ for information. 
(Details -  1: Not running within active session)

One resolution for this, courtesy of SyncEvolution - The Missing Link, is to launch dbus for the duration of the quote retrieval with a cron command similar to

env `dbus-launch` sh -c 'trap "kill $DBUS_SESSION_BUS_PID" EXIT; gnucash --add-price-quotes /path/to/file.gnucash'

Note: This has been documented in Bug #639776

Technical Details

Where the files are stored depends on your OS/Distro:

  • Linux depends on the way it was installed:
    • by package manager: /usr/share/perl5/[vendor/]Finance/Quote
    • by CPAN or gnc-fq-update: /usr/share/perl5/site/Finance/Quote
    • self compiled: /usr/local/share/perl/5.xx.x/Finance/Quote
  • Windows: C:\Perl\site\lib\Finance\Quote

Documentation