Difference between revisions of "Online Quotes"

From GnuCash
Jump to: navigation, search
(Trouble Shooting - Explicitly say to delete C:\Strawberry after uninstalling perl)
(Port Finance::Quote sources from manual to Wiki as agreed in https://github.com/Gnucash/gnucash-docs/pull/345 - this is an export of the contents as in the PR)
 
(74 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 +
[[Category:Investment Management]]
 +
[[Category:{{mac}}]]
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
| [[Using GnuCash | Back to: Using GnuCash]]
 
 
| Languages:
 
| Languages:
 
| [[De/Aktienhandel | Deutsch]]
 
| [[De/Aktienhandel | Deutsch]]
 
| [[Zh-hans/在线报价 | 简体中文]]
 
| [[Zh-hans/在线报价 | 简体中文]]
 +
|}
 +
{| class="wikitable"
 +
|-
 +
| [[Using GnuCash | Back to: Using GnuCash]]
 
|}
 
|}
  
GnuCash can automatically retrieve the current share price of marketable commodities (e.g., stocks, mutual funds, currency exchange rates), called a quote, so that you do not need to manually update the prices of these securities in the [{{BuildURL}}/docs/C/gnucash-guide/invest-stockprice1.html GnuCash Price Database] one at a time. If you are tracking the prices of more than a handful of securities, this features saves an enormous amount of time.
+
GnuCash can automatically retrieve the current currency exchange rates and share price of marketable commodities (such as stocks and mutual funds) - often simply called "quotes" - so that you do not need to manually enter and update them in the [{{URL:docs:guide}}/invest-stockprice1.html GnuCash Price Database] one at a time. If you are tracking the prices of more than a handful of securities, this features saves an enormous amount of time.
 +
 
 +
Before you continue read the '''Official Documentation''':
 +
:;Manual:[{{URL:docs:manual}}/finance-quote.html Setting Up the Quote Retrieval],
 +
::[{{URL:docs:manual}}/acct-create.html#accts-online-quotes Steps to enable Online Quotes updating] per account;
 +
We try to reduce redundancy.
  
 
== Overview ==
 
== Overview ==
GnuCash stores the share '''prices''' of investments in the respective buy/sell/split ''transactions'' and additional '''quotes''' in an internal ''price database''. Although it is possible to enter prices manually into the price database, it is more convenient to update them from online sources. GnuCash uses an external program written in the [{{URL:wp}}Perl Perl] programming language called [{{URL:GH}}finance-quote/finance-quote/blob/master/README.md Finance::Quote] (often shortened to simply ''F::Q'') to fetch these quotes online. Therefore, for this feature of GnuCash to work, your computer will need to have some additional software installed beyond simply the GnuCash application itself, as well as have an active Internet connection.
+
GnuCash stores the share '''prices''' of investments in the respective buy/sell/split ''transactions'', currency exchange rates and additional '''quotes''' in an internal ''price database''. Although it is possible to enter prices manually into the price database, it is more convenient to update them from online sources. GnuCash uses an external program written in the [{{URL:wp}}Perl Perl] programming language called [{{URL:GH}}finance-quote/finance-quote/blob/master/README.md Finance::Quote] (often shortened to simply ''F::Q'') to fetch these quotes online. Therefore, for this feature of GnuCash to work, your computer will need to have some additional software installed beyond simply the GnuCash application itself, as well as have an active Internet connection.
 +
 
 +
F::Q uses source [[#Source_Alphavantage.2C_US|AlphaVantage]] for all currency exchange rates.
  
 
=== About Finance::Quote ===
 
=== About Finance::Quote ===
Line 17: Line 29:
 
: managed at [{{URL:GH}}finance-quote GitHub] and  
 
: managed at [{{URL:GH}}finance-quote GitHub] and  
 
: has a [http://finance-quote.sourceforge.net/ SourceForge website].
 
: has a [http://finance-quote.sourceforge.net/ SourceForge website].
Downloads are available
+
Most linux distributions have packages for recent versions in their own repositories (e.g., dnf install perl-Finance-Quote). In addition for all platforms downloads are available
 
:like for other Perl modules at [https://metacpan.org/release/Finance-Quote CPAN] (both recent),
 
:like for other Perl modules at [https://metacpan.org/release/Finance-Quote CPAN] (both recent),
 
:and additionally at [{{URL:SF}}projects/finance-quote/ SourceForge project].
 
:and additionally at [{{URL:SF}}projects/finance-quote/ SourceForge project].
Line 28: Line 40:
  
 
The Finance::Quote software gathers its price data from several Web sites around the world that provide this information in different ways. Some sources offer
 
The Finance::Quote software gathers its price data from several Web sites around the world that provide this information in different ways. Some sources offer
* an '''API''' like ''JSON'' or ''YQL'',
+
* an '''API''' like ''JSON'' or ''YQL''<ref name="yql" />,
 
* '''download'''s, usually as ''CSV'' file, and finally,
 
* '''download'''s, usually as ''CSV'' file, and finally,
 
* quite literally by extracting information from the web page itself.
 
* quite literally by extracting information from the web page itself.
  
As these sources change frequently, we advise you to keep Finance::Quote up-to-date. (See below for instructions.)
+
As these sources change frequently, we advise you to [[#gnc-fq-update|keep Finance::Quote up-to-date]].
  
 
== Setting up online quotes in GnuCash ==
 
== Setting up online quotes in GnuCash ==
The '''GnuCash Guide''' includes [{{BuildURL}}/docs/C/gnucash-guide/invest-stockprice1.html#invest-stockprice-auto-configure3 instructions] on setting up online quotes. This set up procedure provides the input to Finance::Quote, so it must be completed before the "Get Quotes" button in GnuCash's Price Database will have any effect.
+
The '''GnuCash Guide''' includes [{{URL:docs:guide}}/invest-stockprice1.html#invest-stockprice-auto-configure3 instructions] on setting up online quotes. This set up procedure provides the input to Finance::Quote, so it must be completed before the "Get Quotes" button in GnuCash's Price Database will have any effect.
;Important:
+
 
:# The symbol depends on the source: <Syntaxhighlight lang="console">
+
Below are some extra caveats to keep in mind:
$ gnc-fq-dump currency USD EUR
+
 
1 USD = 0.8409 EUR
+
;Note: The examples below use the command line syntax for GnuCash 5.0 and up. Users of older GnuCash versions can uuse the <tt>gnc-fq-dump</tt> helper script instead. More on this in [[#Obsolete scripts]].
$ gnc-fq-dump yahoo_json USD
+
 
Finance::Quote fields Gnucash uses:
+
# The symbol depends on the source: <Syntaxhighlight lang="console" highlight="13">
    symbol: USD                  <=== required
+
$ gnucash-cli --quotes dump currency USD EUR
      date: 08/17/2020          <=== recommended
+
1 EUR = 1.1004732 USD
  currency: USD                  <=== required
+
$ gnucash-cli -V --quotes dump yahoo_json USD
       last: 72.2                <=\     
+
USD:
      nav:                      <=== one of these
+
        high => 25.7606
    price:                      <=/       
+
        open => 25.2
  timezone:                      <=== optional
+
      close => 24.88
</Syntaxhighlight>
+
        last => 25.7606
:#Some special charcter get interpreted by your command shell:<Syntaxhighlight lang="console" highlight="3-4">
+
  year_range =>        11.65 - 29.65
$ gnc-fq-dump yahoo_json M&M.NS
+
        low => 24.99
 +
    isodate => 2023-05-05
 +
        date => 05/05/2023
 +
        name => USD (ProShares Ultra Semiconductors)
 +
    success => 1
 +
  div_yield => 0
 +
    exchange => Sourced from Yahoo Finance (as JSON)
 +
      method => yahoo_json
 +
       symbol => USD
 +
    currency => USD
 +
        type => ETF
 +
      volume => 20348
 +
          pe => null
 +
        eps => null
 +
</Syntaxhighlight> <tt>Ultra Semiconductors</tt> &ne; <tt>US Dollar</tt>
 +
#Some special characters like <code>&</code> get interpreted by your command shell. For example using "M&M.NS" unquoted would fetch the quote for "M" instead and treat "M.NS" as a separate shell command.<Syntaxhighlight lang="console" highlight="3-4,24">
 +
$ gnucash-cli -V --quotes dump yahoo_json M&M.NS
 
[1] 1732
 
[1] 1732
 
If 'M.NS' is not a typo you can use command-not-found to lookup the package that contains it, like this:
 
If 'M.NS' is not a typo you can use command-not-found to lookup the package that contains it, like this:
 
     cnf M.NS
 
     cnf M.NS
user@host:$ Finance::Quote fields Gnucash uses:
+
M:
    symbol: M                    <=== required
+
      method => yahoo_json
       date: 08/17/2020          <=== recommended
+
    isodate => 2023-05-05
  currency: USD                  <=== required
+
        last => 15.12
      last: 7.15                <=\     
+
       volume => 3446273
       nav:                      <=== one of these
+
      symbol => M
     price:                      <=/       
+
        type => EQUITY
  timezone:                      <=== optional
+
        open => 15
</Syntaxhighlight> Escaping by backslash returns the result for M<Syntaxhighlight lang="console" highlight="5-6,26">
+
        date => 05/05/2023
$ gnc-fq-dump -v yahoo_json M\&M.NS
+
        high => 15.2873
Finance::Quote fields Gnucash uses:
+
  year_range =>        14.48 - 25.12
     symbol: M&M.NS               <=== required
+
       close => 14.75
       date: 08/17/2020          <=== recommended
+
          pe => 3.7425742
  currency: USD                  <=== required
+
    currency => USD
      last: 7.15                <=\        
+
     success => 1
       nav:                      <=== one of these
+
        eps => 4.04
    price:                      <=/       
+
  div_yield => 4.2711865
  timezone:                      <=== optional
+
        low => 14.92
 +
    exchange => Sourced from Yahoo Finance (as JSON)
 +
        name => M (Macy's Inc)
 +
</Syntaxhighlight>Escaping by backslash correctly returns the result for M&M.NS (this was ''not'' working with gnc-fq-dump in prior versions!)<Syntaxhighlight lang="console" highlight="7,9,14">
 +
$ gnucash-cli -V --quotes dump yahoo_json M\&M.NS
 +
M&M.NS:
 +
        eps => null
 +
          pe => null
 +
        low => 1208.05
 +
    exchange => Sourced from Yahoo Finance (as JSON)
 +
     currency => INR
 +
      volume => 4753303
 +
        last => 1211.2
 +
        high => 1242.35
 +
      symbol => M&M.NS
 +
        type => EQUITY
 +
        open => 1232.8
 +
        name => M&M.NS (MAHINDRA &MAHINDRA)
 +
  year_range =>        853.7 - 1397
 +
  div_yield => 0
 +
       method => yahoo_json
 +
        date => 05/05/2023
 +
    success => 1
 +
    isodate => 2023-05-05
 +
      close => 1231.7
 +
</Syntaxhighlight>[{{URL:wp}}Percent-encoding Percent-encoding] also gets the right result, though it returns slightly less readable data (and this was the only option that worked with gnc-fq-dump in prior versions)<Syntaxhighlight lang="console" highlight="5-6,12">
 +
$ gnucash-cli -V --quotes dump yahoo_json 'M%26M.NS'
 +
M%26M.NS:
 +
        eps => null
 +
  div_yield => 0
 +
    currency => INR
 +
        name => M%26M.NS (MAHINDRA &MAHINDRA)
 +
        low => 1208.05
 +
          pe => null
 +
    isodate => 2023-05-05
 +
        open => 1232.8
 +
    exchange => Sourced from Yahoo Finance (as JSON)
 +
        last => 1211.2
 +
      method => yahoo_json
 +
       volume => 4753303
 +
  year_range =>       853.7 - 1397
 +
        date => 05/05/2023
 +
    success => 1
 +
        type => EQUITY
 +
      close => 1231.7
 +
      symbol => M%26M.NS
 +
        high => 1242.35
 +
</Syntaxhighlight>
  
All fields returned by Finance::Quote for stock M&M.NS
+
== Command line interface ==
  
stock          field  value
+
GnuCash also offers a command line tool called "gnucash-cli" that can interact directly with Finance::Quote.  
-----          -----  -----
 
M&M.NS          close: 7.19
 
M&M.NS      currency: USD
 
M&M.NS          date: 08/17/2020
 
M&M.NS      div_yield: 21.001391
 
M&M.NS            eps: -10.174
 
M&M.NS      exchange: Sourced from Yahoo Finance (as JSON)
 
M&M.NS          high: 7.3
 
M&M.NS        isodate: 2020-08-17
 
M&M.NS          last: 7.15
 
M&M.NS            low: 6.82
 
M&M.NS        method: yahoo_json
 
M&M.NS          name: M&M.NS (Macy's Inc)
 
M&M.NS          open: 7.21
 
Use of uninitialized value in printf at /usr/local/bin/gnc-fq-dump line 138.
 
M&M.NS            pe:
 
M&M.NS        success: 1
 
M&M.NS        symbol: M&M.NS
 
M&M.NS          type: EQUITY
 
M&M.NS        volume: 22877920
 
M&M.NS    year_range:        4.38 - 18.57
 
</Syntaxhighlight> but [{{URL:wp}}Percent-encoding Percent-encoding] gets the right result<Syntaxhighlight lang="console" highlight="5-6,27">
 
$ gnc-fq-dump -v yahoo_json 'M%26M.NS'
 
Finance::Quote fields Gnucash uses:
 
    symbol: M%26M.NS            <=== required
 
      date: 08/18/2020          <=== recommended
 
  currency: INR                  <=== required
 
      last: 626.6                <=\     
 
      nav:                      <=== one of these
 
    price:                      <=/       
 
  timezone:                      <=== optional
 
  
All fields returned by Finance::Quote for stock M%26M.NS
+
;Note: Prior to gnucash 5.0 this command line tool was pretty limited with regards to quotes. It could only update quotes in an existing book. For more interaction these releases shipped a few helper scripts. These are documented in [[#Obsolete scripts]].
  
stock          field  value
+
How the command is accessed depends on the operating system; the following examples assume that you're running a unix-like system and that <tt>gnucash-cli</tt> is in a directory included in the <tt>PATH</tt> environment variable. If you're on a unix-like system and <tt>gnucash-cli</tt> isn't accessible via the path, prefix it with its path, e.g.
-----          ----- -----
+
<tt>/opt/gnucash/bin/gnucash-cli</tt>. For other operating systems or [[Flatpak]]:
M%26M.NS        close: 623.6
 
M%26M.NS    currency: INR
 
M%26M.NS        date: 08/18/2020
 
M%26M.NS    div_yield: 0
 
Use of uninitialized value in printf at /usr/local/bin/gnc-fq-dump line 138.
 
M%26M.NS          eps:
 
M%26M.NS    exchange: Sourced from Yahoo Finance (as JSON)
 
M%26M.NS        high: 632.75
 
M%26M.NS      isodate: 2020-08-18
 
M%26M.NS        last: 627.5
 
M%26M.NS          low: 623.8
 
M%26M.NS      method: yahoo_json
 
M%26M.NS        name: M%26M.NS (MAHINDRA &MAHINDRA)
 
M%26M.NS        open: 625
 
Use of uninitialized value in printf at /usr/local/bin/gnc-fq-dump line 138.
 
M%26M.NS          pe:
 
M%26M.NS      success: 1
 
M%26M.NS      symbol: M%26M.NS
 
M%26M.NS        type: EQUITY
 
M%26M.NS      volume: 962990
 
M%26M.NS  year_range:        245.4 - 648.6
 
  
</Syntaxhighlight>
+
:'''Flatpak:'''
Once again, Finance::Quote is ''external to GnuCash.'' Thus, for it to work, you need some additional installed beyond GnuCash itself. This includes the Perl language interpreter itself, the Finance::Quote module, and any dependencies required by this software. Occasionally, you may need to update the Finance::Quote software module (and, more occasionally, the Perl interpreter) separately from GnuCash.
+
    flatpak ---command gnucash-cli org.gnucash.Gnucash &lt;args&gt;
 +
:'''{{mac}} Gnucash.app bundle:'''
 +
    /Applications/Gnucash.app/Contents/{{mac}}/gnucash-cli &lt;args&gt;
 +
:'''Microsoft Windows:'''
 +
    "C:\Program Files (x86)\gnucash\bin\gnucash-cli.exe" &lt;args&gt;
 +
In all cases replace <tt>&lt;args&gt;</tt> with whatever comes after <tt>gnucash-cli</tt> in the examples below.
 +
 
 +
'''<tt>gnucash-cli</tt> has the following quotes related subcommands:'''
 +
 
 +
===gnucash-cli --quotes get <book>===
 +
 
 +
This command opens datafile <book> and attempts to retrieve the most recent price for each quote in it via Finance::Quote. This command was actually introduced already in gnucash 4.0. In older versions still the <tt>gnucash</tt> application itself had the option <tt>--add-price-quotes</tt> to the same effect. This option has now been removed from gnucash 5.0 in favour of the gnucash-cli command instead.
 +
 
 +
;Note: GnuCash 5.0 had a bug in this command, which has been fixed in GnuCash 5.1. To make it work with GnuCash 5.0 you need to add an extra double-dash between get and <book> like so:<SyntaxHighlight lang="console">$ gnucash-cli --quotes get -- <book></SyntaxHighlight>There is a space between '--' and <book> here!
 +
 
 +
===gnucash-cli --quotes info===
 +
 
 +
This command outputs the version number of the Finance::Quote module currently installed as well as a list of sources it can query.<SyntaxHighlight lang="console">$ gnucash-cli --quotes info
 +
Found Finance::Quote version 1.54.
 +
Finance::Quote sources:
 +
aex          alphavantage              amfiindia    asegr        asx         
 +
aufunds      australia    bamosz      bet          bloomberg    bourso     
 +
bse          bseindia    canada      canadamutual              comdirect   
 +
cse          deka        dutch        dwsfunds    europe     
 +
fetch_live_currencies    fidelity    fidelity_direct         
 +
finanzpartner            fondsweb    fool        france      ftfunds     
 +
fundata      fundlibrary  goldmoney    greece      hu          hufund     
 +
hungary      hustock      iexcloud    india        indiamutual 
 +
known_currencies          morningstarau            morningstarch           
 +
morningstarjp            mstaruk      nasdaq      nseindia    nyse       
 +
nzx          onvista      oslobors    romania      seb_funds    sinvestor   
 +
six          tesouro_direto            tiaacref    tmx          tradegate   
 +
tradeville  treasurydirect            troweprice  troweprice_direct       
 +
tsp          tsx          ukfunds      unionfunds  usa          xetra       
 +
yahoo_json  za </SyntaxHighlight>
 +
You can find more details about the sources in the GnuCash Manual:
 +
:[{{URL:docs nightly}}gnucash-manual/tips.html Work in Progress]
 +
:[{{URL:docs:manual}}tips.html Recent Released]
 +
 
 +
Should there be any issue with your Finance::Quote installation it will return an error message with a possible fix.<SyntaxHighlight lang="console">$ gnucash-cli --quotes info
 +
Failed to initialize Finance::Quote: Can't locate JSON.pm in @INC (you may need to install the JSON module) (@INC contains: /usr/local/lib64/perl5/5.36 /usr/local/share/perl5/5.36 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /home/janssege/Development/gnucash/stable/build/bin/finance-quote-wrapper line 277.
 +
BEGIN failed--compilation aborted at /home/janssege/Development/gnucash/stable/build/bin/finance-quote-wrapper line 277.</SyntaxHighlight>
 +
 
 +
;Note: The most recent Finance::Quote version is  {{FQ Version}}.
 +
 
 +
===gnucash-cli --quotes dump===
 +
 
 +
This command returns quote data for a source and a list of symbols in a format which is easy to read ''for humans''. It is useful for checking that a given online quote source is online and functional.
 +
 
 +
To get a stock price, run a command from the command line of the form: <SyntaxHighlight lang="sh">
 +
gnucash-cli -V --quotes dump $SOURCE $SYMBOL
 +
# e.g.
 +
gnucash-cli -V --quotes dump alphavantage IBM
 +
</SyntaxHighlight>
 +
;Note: The ''-V'' parameter is optional. If omitted only the tags relevant to use within gnucash will be printed:<SyntaxHighlight lang="console">$ gnucash-cli --quotes dump alphavantage IBM
 +
Finance::Quote fields GnuCash uses:
 +
    symbol: IBM            <=== required
 +
      date: 05/04/2023      <=== recommended
 +
  currency: USD            <=== required
 +
      last: 122.5700        <=\
 +
      nav:                <=== one of these
 +
    price:                <=/</SyntaxHighlight>If the command is run with the ''-V'' parameter, all tags retrieved from Finance::Quote are printed:<SyntaxHighlight lang="console">$ gnucash-cli -V --quotes dump alphavantage IBM 2>/dev/null
 +
IBM:
 +
        net => -0.8800
 +
        date => 05/04/2023
 +
      volume => 4468237
 +
    isodate => 2023-05-04
 +
        high => 123.5200
 +
    currency => USD
 +
      symbol => IBM
 +
    p_change => -0.7128
 +
      method => alphavantage
 +
    success => 1
 +
      close => 123.4500
 +
        open => 123.0300
 +
currency_set_by_fq => 1
 +
        low => 121.7563
 +
        last => 122.5700</SyntaxHighlight>
  
To ease this update process, the GnuCash developers provide several helper scripts.
+
''Since Finance::Quote 1.41'' the default source for currencies is hardcoded to be Alpha Vantage, e.g. <SyntaxHighlight lang="sh">
 +
gnucash-cli  --quotes dump currency USD EUR
 +
</SyntaxHighlight>
 +
:But it is still possible to get the rate between 2 currencies AAA and BBB using source <tt>Yahoo as JSON</tt>: <SyntaxHighlight lang="sh">
 +
gnucash-cli --quotes dump yahoo_json ${AAA}${BBB}=X
 +
# e.g.
 +
gnucash-cli -V --quotes dump yahoo_json USDEUR=X
 +
</SyntaxHighlight>
  
 
== Helper Scripts ==
 
== Helper Scripts ==
For your convenience, we ship several helper programs designed to make it easier to install, update, and diagnose problems with your installation of the Finance::Quote software module. These programs have names that begin with <tt>gnc-fq-*</tt>, and are themselves written in the Perl programming language.
 
  
;Note for Microsoft Windows users to run perl scripts like <tt>gnc-fq-check</tt>: While [{{URL:wp}}Unixoid unixoid] operating systems use a [{{URL:wp}}Shebang_(Unix) shebang] (<code>#!</code>) to associate perl scripts with the Perl interpreter, others, e.g. Windows, will fail, {{Gnc-fq not recognized doscon}} so use the following:
+
;Note: All helper scripts mentioned in this section are Perl scripts. Before you can use them you must have a functioning Perl installation on your system.
:#Open a command line window:
+
 
:#:;Windows 10 (not in Tablet Mode): Click in the Cortana <tt>Ask me anything</tt> field to the right of the Start button, begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>. Left-click or tap the <tt>Command Prompt icon</tt>.
+
===gnc-fq-update===
:#:;Windows 8 (or Windows 10 in Tablet Mode): From the Start screen, begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>. Left-click or tap the <tt>Command Prompt icon</tt>.
+
 
:#:;Windows 7: click <tt>Start</tt> button, type <tt>cmd</tt> in the <tt>Search programs and files</tt> field, press <tt>Enter</tt>
+
As stated earlier, Finance::Quote is ''external to GnuCash'' and hence managed independently of GnuCash. Linux distributions typically make it easy: you can usually download Finance::Quote from their package repositories. For {{mac}} and Windows a different approach is needed.
:#:;Windows XP: click <tt>Start</tt> button, <tt>All Programs</tt>, <tt>Accessories</tt>, <tt>Command Prompt</tt>
+
 
:#Change to the drive containing the GnuCash program files (usually C drive) if that is not already the current drive: <SyntaxHighlight lang="bat">C:
+
To help with installing and updating on these platforms, GnuCash comes with a helper script called ''gnc-fq-update'' which installs or updates the Finance::Quote software module along with its dependencies.
</SyntaxHighlight>
+
 
:#Change to the ...\gnucash\bin directory which contains the required gnc-fq-xxx perl script:
+
;Notes:
:#:; 32 bit version of Windows: <SyntaxHighlight lang="bat">cd \Program Files\gnucash\bin</SyntaxHighlight>
+
* This program needs superuser or administrative privileges to succeed in Linux or {{Mac}} but not in Windows 10.
:#:; 64 bit version of Windows: <SyntaxHighlight lang="bat">cd \Program Files (x86)\gnucash\bin</SyntaxHighlight>
+
* If you want to use this script on Linux to install a more recent Finance::Quote module than is shipped by your distribution, you may want to uninstall the system package first to avoid any conflicts.
:#Prefix ''any'' gnc-fq-xxx perl script command with <tt>perl</tt> and a space: <SyntaxHighlight lang="bat">perl gnc-fq-check</SyntaxHighlight>
+
* Technically it is a Perl script which calls [[#Installing Finance::Quote using CPAN|CPAN]].
 +
 
 +
===Note for Microsoft Windows users to run Perl scripts like <tt>gnc-fq-update</tt>===
 +
[{{URL:wp}}Unixoid Unixoid] operating systems use a [{{URL:wp}}Shebang_(Unix) shebang] (<code>#!</code>) to associate Perl scripts with the Perl interpreter. Windows, on the other hand, makes no such association. Attempting to execute Perl scripts by directly calling them will fail, as shown below.
 +
{{Gnc-fq not recognized doscon}}
 +
In order to run Perl scripts on Windows, use the following:
 +
#Open a command line window:
 +
#;Windows 10 (not in Tablet Mode):Click in the Cortana <tt>Ask me anything</tt> field to the right of Start Button, begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>. Left-click or tap the <tt>Command Prompt icon</tt>.
 +
#;Windows 8 (or Windows 10 in Tablet Mode):From the Start screen, begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>. Left-click or tap the <tt>Command Prompt icon</tt>.
 +
#;Windows 7:Click Start Button &rarr; type <tt>cmd</tt> in the <tt>Search programs and files</tt> field, press <tt>Enter</tt>
 +
#;Windows XP:Click Start Button &rarr; <tt>All Programs</tt> &rarr; <tt>Accessories</tt> &rarr; <tt>Command Prompt</tt>
 +
#Change to the drive containing the GnuCash program files (usually C drive) if that is not already the current drive:<SyntaxHighlight lang="bat">C:</SyntaxHighlight>
 +
#Change to the ...\gnucash\bin directory which contains the required gnc-fq-xxx Perl scripts:
 +
#;32 bit version of Windows:<SyntaxHighlight lang="bat">cd \Program Files\gnucash\bin</SyntaxHighlight>
 +
#;64 bit version of Windows:<SyntaxHighlight lang="bat">cd \Program Files (x86)\gnucash\bin</SyntaxHighlight>
 +
#Prefix ''any'' gnc-fq-xxx Perl script command with <tt>Perl</tt> and a space:<SyntaxHighlight lang="bat">perl gnc-fq-check</SyntaxHighlight>
 +
 
 +
===Obsolete scripts===
 +
 
 +
GnuCash 5.0 introduces several extra command line options in gnucash-cli to interface with Finance::Quote. These are explained in [[#Command line interface]]. Prior to that release, GnuCash provided a few extra helper scripts to achieve the same. While no longer available for GnuCash 5.0 and later, they are still mentioned here for historical interest.
  
Along with your GnuCash installation, you should have the following helper programs:
+
====gnc-fq-check====
;gnc-fq-check: This program returns the version number of and the list of modules available to the Finance::Quote software. It will also inform you if there is a problem with your Finance::Quote installation or if it is missing, and may suggest a fix.
+
:;Replaced by: [[#gnucash-cli --quotes info]]
 +
This program returns the version number of Finance::Quote module currently installed as well as a list of sources available via the Finance::Quote module. It will also inform you if there is a problem with your Finance::Quote installation or if it is missing, and may suggest a fix.
 
:;Example with broken dependency: {{FQ Check broken}} The first part is the error message about a missing <tt>Mozilla/CA.pm</tt>.
 
:;Example with broken dependency: {{FQ Check broken}} The first part is the error message about a missing <tt>Mozilla/CA.pm</tt>.
::At the end in brackets is the normal output of version and available sources.
+
::At the end in parentheses is the normal output of the currently installed Finance::Quote version and a list of available sources.
::;Note: The recent version is  {{FQ Version}}.
+
::''Note:'' The most recent Finance::Quote version is  {{FQ Version}}.
:If an error is displayed, see the next section <tt>gnc-fq-update</tt>, else continue with <tt>gnc-fq-dump</tt>.
+
:If an error is displayed, see the next section <tt>gnc-fq-update</tt>. Otherwise, continue with <tt>gnc-fq-dump</tt>.
;gnc-fq-update: This program installs or updates the Finance::Quote software module along with its dependencies. This program needs superuser or administrative privileges to succeed in Linux or {{Mac}} but not in Windows 10.
 
;gnc-fq-dump: This program returns quote data for a source and a list of symbols in a format, which is easy to read ''for humans''. It is useful for checking that a given online quote source is online and functional.
 
  
:To get a stock price, run a command from the command line of the form:
+
====gnc-fq-dump====
:<SyntaxHighlight lang="sh">gnc-fq-dump -v <source> <symbol>
+
:;Replaced by: [[#gnucash-cli --quotes dump]]
E.g.
+
This program returns quote data for a source and a list of symbols in a format which is easy to read ''for humans''. It is useful for checking that a given online quote source is online and functional.
gnc-fq-dump -v alphavantage IBM</SyntaxHighlight>
+
:To get a stock price, run a command from the command line of the form: <SyntaxHighlight lang="sh">
:To get a currency conversion rate between 2 currencies aaa and bbb using source <tt>Yahoo as JSON</tt>:
+
gnc-fq-dump -v $SOURCE $SYMBOL
:<SyntaxHighlight lang="sh">gnc-fq-dump -v yahoo_json aaabbb=X
+
# e.g.
E.g.
+
gnc-fq-dump -v alphavantage IBM
gnc-fq-dump -v yahoo_json USDEUR=X</SyntaxHighlight>
+
</SyntaxHighlight>
:Since Finance::Quote version 1.41, the default source for currencies is hardcoded to be Alpha Vantage. E.g.
+
:''Since Finance::Quote 1.41'' the default source for currencies is hardcoded to be Alpha Vantage, e.g. <SyntaxHighlight lang="sh">
:<SyntaxHighlight lang="sh">gnc-fq-dump currency USD EUR</SyntaxHighlight>
+
gnc-fq-dump currency USD EUR
:To test that Finance::Quote is working for currencies within GnuCash, find a two-currency transaction and right-click on it, then select ''Edit Exchange Rate'' in the context menu. The transfer dialog will appear. Click the ''Fetch Rate'' button and if everything is behaving itself the current rate will fill in the exchange rate box.
+
</SyntaxHighlight>
 +
:But it is still possible to get the rate between 2 currencies AAA and BBB using source <tt>Yahoo as JSON</tt>: <SyntaxHighlight lang="sh">
 +
gnc-fq-dump -v yahoo_json ${AAA}${BBB}=X
 +
# e.g.
 +
gnc-fq-dump -v yahoo_json USDEUR=X
 +
</SyntaxHighlight>
 +
:To test that Finance::Quote is working for currencies ''within GnuCash'',
 +
:# find a two-currency transaction and
 +
:# right-click on it, then
 +
:# select ''Edit Exchange Rate'' in the context menu.
 +
:The transfer dialog will appear. Click the ''Fetch Rate'' button and if everything is behaving itself the current rate will fill in the exchange rate box.
  
;gnc-fq-helper: This program is a filter, which does the same thing as <tt>gnc-fq-dump</tt>, but in a form which ''the program understands''. Input and output are [{{URL:wp}}Scheme_(programming_language) Scheme] expressions. This helps developers to decide, if the error is in GnuCash or F::Q. It shows also trailing spaces in downloaded quotes.
+
====gnc-fq-helper====
:As an example, in September 2008 an Unilever bond was reported to fail. Here is a sample execution and result of this helper program: <Syntaxhighlight lang="console">
 
user@host:~$ echo '(yahoo_json "A0GFY7.SG")' | gnc-fq-helper
 
(("A0GFY7.SG" (symbol . "A0GFY7.SG") (gnc:time-no-zone . "2008-09-26 16:58:00") (last . 89.50) (currency . "EUR ")))
 
</Syntaxhighlight>Do you see the error? [{{BugURL}}/show_bug.cgi?id=553902#c4 Solution]
 
  
Since these helper programs are Perl scripts, you must have a functioning Perl installation before any of these helper programs will run successfully.
+
This script is the interface between GnuCash and Finance::Quote and primarily intended to be used by GnuCash internally. It does more or less what <tt>gnc-fq-dump</tt> does, but in a form which ''the program understands''. Input and output are [{{URL:wp}}Scheme_(programming_language) Scheme] expressions.
  
 
==Requirements==
 
==Requirements==
Line 196: Line 326:
 
To check if Perl is installed, invoke the <SyntaxHighlight lang="sh" inline>perl -v</SyntaxHighlight> command at a terminal prompt to get the Perl interpreter's version number. If that fails, the best bet is to use your package manager to install it. Refer to your operating system's documentation for additional details on using your package manager.
 
To check if Perl is installed, invoke the <SyntaxHighlight lang="sh" inline>perl -v</SyntaxHighlight> command at a terminal prompt to get the Perl interpreter's version number. If that fails, the best bet is to use your package manager to install it. Refer to your operating system's documentation for additional details on using your package manager.
  
The GnuCash [[Flatpak]] has a working perl and Finance::Quote already installed. You will need to add your [[#Source Alphavantage, US|Alpha Vantage]] API key if you require currency conversion rates or to use Alpha Vantage as a price source.
+
The GnuCash [[Flatpak]] has a working perl and Finance::Quote already installed. You will need to add your [[#Source Alphavantage, US|Alpha Vantage]] API key if you require currency conversion rates or to use Alpha Vantage as a price source. If you need to get currency conversion rates, you need Finance::Quote version 1.53 or later which was first included in the GnuCash 4.12-1 Flatpak. If you need a more recent version of ''F::Q'' than is included in the latest GnuCash Flatpak, you should wait until the GnuCash developers incorporate the version you need in the GnuCash Flatpak as it is not easy to update ''F::Q'' in the Flatpak because it doesn't contain the tools CPAN needs.
  
 
==== Installing Perl on {{Mac}} ====
 
==== Installing Perl on {{Mac}} ====
 
On Apple's {{Mac}} computers, Perl is already installed by default. To confirm this, open the Terminal application (usually located in the Utilities folder of your Applications folder), and invoke the <SyntaxHighlight lang="sh">
 
On Apple's {{Mac}} computers, Perl is already installed by default. To confirm this, open the Terminal application (usually located in the Utilities folder of your Applications folder), and invoke the <SyntaxHighlight lang="sh">
perl -v
+
/usr/bin/perl -v
 
</SyntaxHighlight> command to see the Perl interpreter's version number.
 
</SyntaxHighlight> command to see the Perl interpreter's version number.
  
Line 207: Line 337:
  
 
===== GnuCash 2.5 and more recent =====
 
===== GnuCash 2.5 and more recent =====
Everything is done for you by running the "Install Online Price Retrieval" command. You can find this in the Windows start menu under the GnuCash group. This will install [{{URL:wp}}Strawberry_Perl Strawberry perl] and all the perl modules required to run Finance::Quote. With typical Windows 10 security, you need Administrator privileges to install perl. After you initiate "Install Online Price Retrieval", a User Access Control window will appear to confirm you intend to install software (if you are an Administrator), or to enable you to enter the credentials of an administrative user (if not). Installation can take from 15 minutes to several hours or more depending on the speed of your PC and internet connection.
+
Everything is done for you by running the "Install Online Price Retrieval" command. You can find this in the Windows start menu under the GnuCash group. This will install [{{URL:wp}}Strawberry_Perl Strawberry perl] and all the perl modules required to run Finance::Quote.
 +
*With typical Windows 10 security, you need '''Administrator privileges''' to install perl.
 +
:After you initiate "Install Online Price Retrieval", a <tt>User Access Control</tt> window will appear
 +
:;if you are an Administrator: to confirm you intend to install software , or
 +
:;else: to enable you to enter the credentials of an administrative user.
 +
*Installation can take from 15 minutes to several hours or more depending on the speed of your PC and internet connection.
  
 
'''No such file or directory''' or '''permission denied''' errors while installing Strawberry perl:
 
'''No such file or directory''' or '''permission denied''' errors while installing Strawberry perl:
 
+
:Turning of anti-virus software while installing perl may help.
Turning of anti-virus software while installing perl may help.
+
:This issue was reported to McAfee as Service Request number 1446848354 16 Mar 2014.
This issue was reported to McAfee as Service Request number 1446848354 16 Mar 2014.
 
  
 
===== GnuCash 2.4 and before =====
 
===== GnuCash 2.4 and before =====
Line 255: Line 389:
 
sudo /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
 
sudo /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
 
</Syntaxhighlight>
 
</Syntaxhighlight>
 +
The first time you run <code>gnc-fq-update</code> or <code>cpan</code> cpan will display some questions:
 +
<Syntaxhighlight lang="console" highlight="7,17">
 +
Loading internal logger. Log::Log4perl recommended for better logging
  
If the <tt>FinanceQuote Update</tt> applet fails, you can simply run the above command while logged in to a user account with administrative privileges. (Note that a mere <Syntaxhighlight lang="sh" inline>su</Syntaxhighlight> may not be sufficient; you should log out of all user accounts, then log in as the admin user for the computer on which you want to install Finance::Quote, then run the above command from a Terminal.)
+
CPAN.pm requires configuration, but most of it can be done automatically.
 +
If you answer 'no' below, you will enter an interactive dialog for each
 +
configuration option instead.
  
As with the applet, you can re-run the command as often as you like to ensure the Finance::Quote module remains up to date.
+
Would you like to configure as much as possible automatically? [yes]
 +
 
 +
Warning: You do not have write permission for Perl library directories.
 +
 
 +
To install modules, you need to configure a local Perl library directory or
 +
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
 +
module or by configuring itself to use 'sudo' (if available).  You may also
 +
resolve this problem manually if you need to customize your setup.
 +
 
 +
What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 +
[local::lib] sudo
 +
</Syntaxhighlight>
 +
Unless you're a perl expert and know differently, you should accept the default <code>yes</code> on the first question and select <code>sudo</code> on the second. That will invoke sudo for every install step, and so will sometimes stop and request your password to authenticate sudo.
 +
 
 +
Compiled binaries on Apple Silicon (aka M1, M2, etc.) processors can be native or Intel. The latter run under a special program called Rosetta2 and GnuCash may be one such program if you're using an x86_64 build. (Apple Silicon builds are available since GnuCash 5.8). The Perl binaries that Apple supplies are  multi-architecture ("universal" in Apple-speak) but left to itself <code>cpan</code> will install only native binaries resulting in GnuCash not being able to use them. You can tell cpan to install Finance::Quote for Intel with
 +
<Syntaxhighlight lang="sh">
 +
    arch -x86_64 /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
 +
</Syntaxhighlight>
 +
but that has risks: If cpan decides to update itself or if you use cpan for other purposes you can wind up with a mix of Apple Silicon and Intel binaries that can break your perl installation. It's better to set the environment variable <code>ARCHFLAGS='-arch arm64 -arch arm64e -arch x86_64'</code> to get cpan to always make universal binaries. To do that for <code>Finance::Quote</code> only you can run
 +
<Syntaxhighlight lang="sh">
 +
    ARCHFLAGS='-arch arm64 -arch arm64e -arch x86_64' /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
 +
</Syntaxhighlight>
 +
but if you use perl for other things you might prefer to set <code>ARCHFLAGS</code> in you shell profile so that cpan always builds universal binaries.
 +
 
 +
If you've already run <code>cpan</code> or <code>gnc-fq-update</code> without having set <code>ARCHFLAGS</code> you may need to clean <code>/Library/Perl/&lt;perl-version&gt;</code>. There may be several versions in <code>/Library/Perl</code> especially if you've upgraded your {{mac}} from previous versions instead of having a clean install or used the Migration Assistant to load a new Mac from an old one. The only one that matters is the one corresponding to the current version of <code>/usr/bin/perl</code>. To check that run
 +
<Syntaxhighlight lang="sh">
 +
/usr/bin/perl --version
 +
</Syntaxhighlight>
 +
You can ignore any micro version numbers. A safe way to clean e.g. <code>/Library/Perl/5.30</code> is
 +
<Syntaxhighlight lang="sh">
 +
sudo mv /Library/Perl/5.30 /Library/Perl/saved-5.30
 +
sudo mkdir /Library/Perl/5.30
 +
sudo cp /Library/Perl/saved-5.30/AppendToPath /Library/Perl/5.30/
 +
</Syntaxhighlight>
 +
Once you've completed reinstalling all of your extra perl modules you can compare <code>5.30</code> and <code>saved-5.30</code> to make sure you didn't miss anything. Once you're satisfied you can safely delete <code>/Library/Perl/saved-5.30</code>.
 +
 
 +
Note the last line in that procedure: <code>/Library/Perl/5.xx/AppendToPath</code> contains a single line, <code>/System/Library/Perl/5.xx/Extras</code>. If the file is missing or is missing that line then a lot of perl infrastructure is missing too and installing Finance::Quote will either take a long time while <code>cpan</code> installs all of those modules; it may fail altogether because certain C libraries or their headers (notably <code>OpenSSL</code>) aren't installed where <code>cpan</code> can find them. A normal installation of Finance::Quote will include only a few modules and provided you have a reasonable fast internet connection will take only 2-3 minutes. If it's taking longer check that <code>AppendToTargets</code> is installed and contains the right path. You can double-check it by printing the include-path variable <code>@INC</code>. Run either
 +
<Syntaxhighlight lang=sh>
 +
perl -V | tail
 +
</Syntaxhighlight>
 +
or
 +
<Syntaxhighlight lang=sh>
 +
perl -e 'print(join("\n", @INC), "\n");'
 +
</Syntaxhighlight>
 +
and check for <code>/System/Library/Perl/Extras/5.xx</code> and <code>/System/Library/Perl/Extras/5.xx/darwin-thread-multi-2level</code> are at the end of the list.
 +
If they're not clear </Library/Perl/5.xx</code using the procedure above and fix <code>AppendToPath</code>.
 +
;Note: {{mac}} will not allow you to use <code>cat</code> to create or modify <code>AppendToPath</code> but you can use any plain text editor including TextEdit or <code>nano</code>.
 +
 
 +
Credit for the environment variable belongs to this [https://stackoverflow.com/q/75983186 Stack Overflow answer] and it also provides more background. The procedure to clear out cpan-installed modules is from [https://bugs.gnucash.org/show_bug.cgi?id=798928#c11 Bug 798928 comment 11].
  
 
The <tt>gnc-fq-update</tt> script always runs the {{mac}} system Perl runtime (<tt>/usr/bin/perl</tt>), and disregards the Perl installed by package managers. Doing so ensures GnuCash, when launched from Finder, can locate Finance::Quote correctly.
 
The <tt>gnc-fq-update</tt> script always runs the {{mac}} system Perl runtime (<tt>/usr/bin/perl</tt>), and disregards the Perl installed by package managers. Doing so ensures GnuCash, when launched from Finder, can locate Finance::Quote correctly.
Line 265: Line 452:
 
On a ''Linux'' computer, the recommended way to install Finance::Quote is by searching in your OS distribution's package manager for <tt>finance-quote</tt>. Note that your distribution's package maintainer may prefix or suffix the package name with ''perl'', ''lib'', or both. For example, in Ubuntu 18.04 and later, the package is called <tt>libfinance-quote-perl</tt>. We also recommend that you check the version of Finance::Quote offered by your OS package repositories to ensure it is a recent-enough version.
 
On a ''Linux'' computer, the recommended way to install Finance::Quote is by searching in your OS distribution's package manager for <tt>finance-quote</tt>. Note that your distribution's package maintainer may prefix or suffix the package name with ''perl'', ''lib'', or both. For example, in Ubuntu 18.04 and later, the package is called <tt>libfinance-quote-perl</tt>. We also recommend that you check the version of Finance::Quote offered by your OS package repositories to ensure it is a recent-enough version.
  
If no ''recent'' version of the Finance::Quote module is offered by your '''package manager''', you should run the <tt>gnc-fq-update</tt> helper script manually. As <tt>root</tt> (using the <tt>su</tt> and/or the <tt>sudo</tt> commands) run the GnuCash Finance Quote update script:
+
If no ''recent'' version of the Finance::Quote module is offered by your '''package manager''', you should run the <tt>gnc-fq-update</tt> helper script manually. As <tt>root</tt> (using the <tt>su</tt> and/or the <tt>sudo</tt> commands) run the GnuCash Finance Quote update script: <Syntaxhighlight lang="sh">
 
 
<Syntaxhighlight lang="sh">
 
 
gnc-fq-update
 
gnc-fq-update
 
</Syntaxhighlight>
 
</Syntaxhighlight>
Line 274: Line 459:
  
 
:;Note for (Ubuntu based) distributions: Some of them removed it from the package. In this case you can
 
:;Note for (Ubuntu based) distributions: Some of them removed it from the package. In this case you can
::* download it from [{{URL:GH}}Gnucash/gnucash/blob/maint/libgnucash/quotes/gnc-fq-update.in github] e.g. into your personal <tt>~/bin</tt> directory,
+
::# download it from [{{URL:GH}}Gnucash/gnucash/blob/maint/libgnucash/quotes/gnc-fq-update.in github] e.g. into your personal <tt>~/bin</tt> directory,
::*In the first line replace <tt>@-PERL-@</tt> with the path to your perl executable, e.g., <tt>/usr/bin/perl</tt>, remove the trailing <tt>.in</tt> from its name and mark the file as executable.
+
::# Execute <Syntaxhighlight lang="console">
 +
$ which perl
 +
/usr/bin/perl
 +
</Syntaxhighlight> to get the proper path to your perl executable,
 +
::# In the first line replace <tt>@-PERL-@</tt> with that path—here <tt>/usr/bin/perl</tt>
 +
::#:remove the trailing <q>.in</q> from its name and
 +
::#:mark the file as executable.
 
::A discussion of how to fix it in Ubuntu can be found at [{{ListURL}}/pipermail/gnucash-user/2012-September/045931.html gnucash-user/2012-September].
 
::A discussion of how to fix it in Ubuntu can be found at [{{ListURL}}/pipermail/gnucash-user/2012-September/045931.html gnucash-user/2012-September].
  
Line 285: Line 476:
  
 
==== Installing Finance::Quote using CPAN ====
 
==== Installing Finance::Quote using CPAN ====
[https://cpan.org/ CPAN] is the '''Comprehensive Perl Archive Network''', which provides a collection of free Perl software (called modules) from which you can obtain the perl Finance::Quote module along with all of its dependencies. If the methods listed above for your specific Operating System distribution fails, you may nevertheless be able to install Finance::Quote by directly interfacing with CPAN yourself.
+
[https://cpan.org/ CPAN] is
 +
# the '''Comprehensive Perl Archive Network''', which provides a collection of free Perl software (called modules),
 +
# a '''program''' with which you can obtain the perl Finance::Quote module along with all of its dependencies from there.
 +
 
 +
If the methods listed above for your specific Operating System or distribution fail, you may nevertheless be able to install Finance::Quote by directly interfacing with CPAN yourself.
  
 
To do so using CPAN:
 
To do so using CPAN:
Line 333: Line 528:
 
Global players: Alpha Vantage and Yahoo* are stronger in shares and Morningstar* in funds.
 
Global players: Alpha Vantage and Yahoo* are stronger in shares and Morningstar* in funds.
  
A fast way to check you have the correct source and symbol is to use [[#Helper_Scripts|Helper Script]] gnc-fq-dump. Run from a commandline <syntaxhighlight lang="sh">gnc-fq-dump -v <Source> <Symbol></syntaxhighlight>
+
A fast way to check you have the correct source and symbol is to use [[#Command line interface|gnucash-cli]] --quote dump. Run from a commandline <syntaxhighlight lang="sh">gnucash-cli -V --quote dump <Source> <Symbol></syntaxhighlight>
  
 
===Source Alphavantage, US===
 
===Source Alphavantage, US===
Finance::Quote's <tt>alphavantage</tt> and <tt>currency</tt> sources require an AlphaVantage API key that you can get free from the [{{AV}} AlphaVantage Website]. Command-line [[#Helper_Scripts|Helper Scripts]] like <tt>gnc-fq-dump</tt> will obtain the key from the <tt>ALPHAVANTAGE_API_KEY</tt> environment variable. GnuCash will too if it uses the same environment.  
+
This source was introduced with Finance::Quote version 1.41.
 +
 
 +
Finance::Quote's <tt>alphavantage</tt> and <tt>currency</tt> sources require since then an AlphaVantage API key that you can get free from the [{{URL:AV}} AlphaVantage Website]. You can set this key in the GnuCash preferences and it will then be used by GnuCash as well as gnucash-cli.
 +
 
 +
;Note: For the [[#Obsolete scripts|obsolete command line scripts]] like <tt>gnc-fq-dump</tt> you will need to set an environment variable <tt>ALPHAVANTAGE_API_KEY</tt>.
 +
 
 +
:;Currency Problem in 2022:
 +
::GnuCash temporarily stopped being able to retrieve currency exchange rates using a free AlphaVantage API key from about Aug 15 2022 because AlphaVantage made the method ''F::Q'' used to obtain exchange rates unavailable for free API keys.
 +
::''F::Q'' has been modified to work with AlphaVantage free API keys and this is available in ''F::Q'' version 1.53 which was released on CPAN Oct 12 2022. Unfortunately in ''F::Q'' 1.53, which uses the FX_DAILY API, currency quotes are not available for Crypto and Precious Metals.
 +
::''F::Q'' 1.53 has been updated into the GnuCash 4.12-1 Linux Flatpak.
 +
::See [https://bugs.gnucash.org/show_bug.cgi?id=798599 Bug 798599].
 +
 
 +
::Around Oct 9 2022 AlphaVantage removed the recent requirement that the CURRENCY_EXCHANGE_RATE API require a Premium API Key, so ''F::Q'' has reverted the changes in [https://github.com/finance-quote/finance-quote/pull/230 Pull 230] to use FX_DAILY instead of CURRENCY_EXCHANGE_RATE for currency quotes. This is in ''F::Q'' 1.54 which was released Dec 27 2022. ''F::Q'' 1.54 has not yet been updated into the latest Linux Flatpak.
  
 
Some sources are <tt>multiple</tt> sources. Multiple sources will be tried, until a price is obtained.
 
Some sources are <tt>multiple</tt> sources. Multiple sources will be tried, until a price is obtained.
 
If you use a multiple source that includes <tt>alphavantage</tt>, then you should use an AlphaVantage API key.
 
If you use a multiple source that includes <tt>alphavantage</tt>, then you should use an AlphaVantage API key.
See [{{BuildURL}}/docs/C/gnucash-help/fq-sources.html#fq-sources-multiple/ A.1.3. Finance::Quote Sources - Multiple sources]
+
See [{{URL:docs:manual}}/fq-sources.html#fq-sources-multiple/ A.1.3. Finance::Quote Sources - Multiple sources]
  
For GnuCash to be able to use Online Quotes, if the API key is not already specified in the environment, it can be entered in
+
To use the API key
:* ''GnuCash versions 2.6.20/2.7.4 and newer:''
+
:;in Gnucash—the program:it can be entered in:
:::<tt>Online Quotes</tt> tab of GnuCash <tt>Preferences</tt>
+
::;GnuCash versions since 2.6.20/2.7.4: (in the Program) <tt>Edit->Preferences</tt> tab <tt>Online Quotes</tt>;
:* ''GnuCash versions 2.6.19/2.7.3 and older:''
+
::;GnuCash up to 2.6.19/2.7.3: It has to be set in the [[Configuration_Locations#File_environment.local|environment.local]] file:
:::[[Configuration_Locations#File_environment.local|environment.local]] file. Quit GnuCash if it's running and using any text editor (Windows users should prefer Notepad to WordPad or Word); you'll need administrator privileges in most cases) add  
+
:::# Quit GnuCash if it's running;
:::::<tt>ALPHAVANTAGE_API_KEY=##############</tt>
+
:::# you'll need administrator privileges in most cases, see the docs of your OS;
:::::to the <tt>environment.local</tt> file, substituting your key for "#############".
+
:::# use any text editor (Windows users should prefer Notepad to WordPad or Word)and add <syntaxhighlight lang="ini">ALPHAVANTAGE_API_KEY=##############</syntaxhighlight> to the <tt>environment.local</tt> file, substituting your key for "#############".
 
+
:;in the [[#Helper_Scripts|Helper Scripts]] ''gnc-fq-dump'' and ''gnc-fq-helper'': To use ''Alpha Vantage'' sources outside of GnuCash, it is necessary to put the ALPHAVANTAGE_API_KEY into your ''command line's environment'' like
For the [[#Helper_Scripts|Helper Scripts]] ''gnc-fq-dump'' and ''gnc-fq-helper'' to use ''Alpha Vantage'' sources outside of GnuCash, it is necessary to put the ALPHAVANTAGE_API_KEY into the Helper Scripts environment.
+
::;Linux or {{Mac}}: <syntaxhighlight lang="sh">
For example<br>
 
'''Linux or {{Mac}}'''
 
::<syntaxhighlight lang="sh">
 
 
ALPHAVANTAGE_API_KEY=############## gnc-fq-dump alphavantage CSCO</syntaxhighlight>
 
ALPHAVANTAGE_API_KEY=############## gnc-fq-dump alphavantage CSCO</syntaxhighlight>
::or
+
:::or <syntaxhighlight lang="sh">
::<syntaxhighlight lang="sh">
 
 
export ALPHAVANTAGE_API_KEY=##############
 
export ALPHAVANTAGE_API_KEY=##############
 
gnc-fq-dump alphavantage CSCO</syntaxhighlight>
 
gnc-fq-dump alphavantage CSCO</syntaxhighlight>
'''Windows'''
+
::;Windows: <syntaxhighlight lang="bat">
::<syntaxhighlight lang="bat">
 
 
cd \Program Files (x86)\gnucash\bin
 
cd \Program Files (x86)\gnucash\bin
 
set ALPHAVANTAGE_API_KEY=##############
 
set ALPHAVANTAGE_API_KEY=##############
 
gnc-fq-dump alphavantage CSCO
 
gnc-fq-dump alphavantage CSCO
 
</syntaxhighlight>
 
</syntaxhighlight>
To have the key available in every session you can also add it to your OS's environment or your command shell configuration. See your OS's manual.
+
::;Tip: To have the key available in every session you can also add it to your OS's environment or your command shell configuration. See your OS's manual.
  
You need Finance::Quote version 1.41 or later to use Alpha Vantage.
+
Alpha Vantage has limited the number of stock and currency quotes that may be requested in a given period using their ''free API key''. If this limit is exceeded, GnuCash will show "unknown error". Finance::Quote v#1.48 and later copes with this for stock quotes, and v1.49 copes with this for currency quotes, although v1.50 (yet to be released as at Jun 14 2020) copes better. Paid [{{URL:AV}}premium/ Premium Alpha Vantage subscriptions] do not have this limit.
 
 
Alpha Vantage has limited the number of stock and currency quotes that may be requested in a given period using their ''free API key''. If this limit is exceeded, GnuCash will show "unknown error". Finance::Quote v#1.48 and later copes with this for stock quotes, and v1.49 copes with this for currency quotes, although v1.50 (yet to be released as at Jun 14 2020) copes better. Paid [{{AV}}premium/ Premium Alpha Vantage subscriptions] do not have this limit.
 
  
 
'''Searching for a Symbol'''
 
'''Searching for a Symbol'''
Line 384: Line 584:
 
</Syntaxhighlight>
 
</Syntaxhighlight>
  
'''Australian Stock Exchange'''
+
====Notes on Specific Exchanges====
 +
;Australian Stock Exchange
 +
:Quotes may be obtained by using source '''Australian Stock Exchange''' or '''Yahoo as JSON'''. These are ''asx'' and ''yahoo_json'' respectively in gnc-fq-dump.
  
Getting quotes from Alpha Vantage for stocks listed on the ASX in currency AUD using a .AX suffix on the stock symbol (e.g. CBA.AX) stopped working sometime between 18 Mar 2018 and 30 May 2020.
+
:Getting quotes from Alpha Vantage for stocks listed on the ASX in currency AUD using a .AX suffix on the stock symbol (e.g. CBA.AX) stopped working sometime between 18 Mar 2018 and 30 May 2020.
  
'''London Stock Exchange'''
+
;London Stock Exchange': It has been reported on [{{ListURL}}/pipermail/gnucash-user/2020-July/091893.html GnuCash User Email List] that LSE stocks that previously Alpha Vantage was able to provide quotes for (e.g. BP.L), stopped working on 25 Jun 2020.
 
 
It has been reported on [{{ListURL}}/pipermail/gnucash-user/2020-July/091893.html GnuCash User Email List] that LSE stocks that previously Alpha Vantage was able to provide quotes for (e.g. BP.L), stopped working on 25 Jun 2020.
 
  
 
=== Source Yahoo ===
 
=== Source Yahoo ===
 
On 1 November 2017 '''Yahoo!''' discontinued its ''csv interface'', which had been the primary source that Finance::Quote used for all ''currency'' quotes and the following stock quotes:
 
On 1 November 2017 '''Yahoo!''' discontinued its ''csv interface'', which had been the primary source that Finance::Quote used for all ''currency'' quotes and the following stock quotes:
: ''yahoo*'' (with exception of json and yql), ''canada'', ''usa'', ''nyse'', ''nasdaq'', ''vanguard''.
+
: ''yahoo*'' (with exception of json <s>and yql</s><ref name="yql">On January 3, 2019 Yahoo retired the [{{URL:wp}}Yahoo!_Query_Language YQL] API service. so '''Yahoo as YQL''' was removed from Finance::Quote 1.50.
 +
</ref>), ''canada'', ''usa'', ''nyse'', ''nasdaq'', ''vanguard''.
  
 
The Finance::Quote maintainers have set up a new source, [[#Source Alphavantage, US|Alpha Vantage]], to replace most of the discontinued Yahoo sources.
 
The Finance::Quote maintainers have set up a new source, [[#Source Alphavantage, US|Alpha Vantage]], to replace most of the discontinued Yahoo sources.
  
To update yahoo sources that no longer work, use the Security Editor in GnuCash to edit every security with ''Get Online Quotes'' enabled that uses a discontinued Yahoo! source and either disable (uncheck) ''Get Online Quotes'' or  
+
To update yahoo sources that no longer work, use the Security Editor in GnuCash to edit every security with ''Get Online Quotes'' enabled that uses a discontinued Yahoo! source and either
:;GnuCash 2.6.20/2.7.7 and newer: change the source to "Alphavantage, US", "Yahoo as JSON" or "Yahoo as YQL".
+
* disable (uncheck) ''Get Online Quotes'' or
:;older: change the the type of quote source to "Unknown" and the source to "alphavantage".
+
* change the source to "Yahoo as JSON"<s>, "Yahoo as YQL"</s><ref name="yql" /> or
 +
*;GnuCash 2.6.20/2.7.7 and newer: "Alphavantage, US";
 +
*;older: change the the type to "Unknown"
 +
*: and the source to "alphavantage".
  
If using "Yahoo as JSON" or "Yahoo as YQL" for a non-US stock, you may have to append a suffix to the end of the stock symbol to tell Finance::Quote what stock exchange the stock is listed on. E.g. ''CBA.AX'' gets the quote price for stock CBA on the Australian Stock Exchange in currency AUD. See [https://help.yahoo.com/kb/exchanges-data-providers-yahoo-finance-sln2310.html Exchanges and data providers on Yahoo Finance].
+
If using "Yahoo as JSON" <s>or "Yahoo as YQL"</s><ref name="yql" /> for a non-US stock, you may have to append a suffix to the end of the stock symbol to tell Finance::Quote what stock exchange the stock is listed on. E.g. ''CBA.AX'' gets the quote price for stock CBA on the Australian Stock Exchange in currency AUD. See [https://help.yahoo.com/kb/exchanges-data-providers-yahoo-finance-sln2310.html Exchanges and data providers on Yahoo Finance].
  
 
:;Tip: you can still ''test'' currencies by <syntaxhighlight lang="sh">gnc-fq-dump -v yahoo_json USDEUR=X
 
:;Tip: you can still ''test'' currencies by <syntaxhighlight lang="sh">gnc-fq-dump -v yahoo_json USDEUR=X
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
== Finance::Quote Sources ==
 +
 +
This chapter gives you some background information about Finance::Quote. Due to nature of gathering finance quotes (web scrapping, unstable API) the list of quote sources is constantly evolving.
 +
 +
Some modules are considered Active, that means it should be possible to fetch quotes using them. Please see [[#Active Individual Quote Sources]] and [[#Active Multiple Quote Sources]] for detailed lists.
 +
 +
Some sources may be considered obsolete that means that support for them has been removed (or is being removed), or they are not functioning correctly. Please see [[#Obsolete Individual Quote Sources]] and [[#Obsolete Multiple Quote Sources]] for detailed list.
 +
 +
If a particular source is the only place where the quote can be obtained but it's been failing or is obsolete, please reach out to Finance::Quote maintainers at https://github.com/finance-quote/finance-quote.
 +
 +
There are 3 types of sources of which the first - currency - is hardcoded and responsible to fetch ISO currencies. The other two can be selected in the <tt>Tools->Security Editor</tt>.
 +
 +
=== Finance::Quote Sources - Currency Source ===
 +
 +
{| id="gnc-tbl-fq-currency-source" class="wikitable"
 +
|+ Currency source for Finance::Quote
 +
|-
 +
! GnuCash Name !! Finance::Quote Name !! Notes
 +
|-
 +
| Currency || currency || End of 2017 the provider changed. Make sure, you updated F::Q to at least version 1.47 and follow the instructions at AlphaVantage below.
 +
|}
 +
 +
=== Finance::Quote Sources - Individual Sources ===
 +
 +
==== Active Individual Quote Sources ====
 +
 +
{| id="gnc-tbl-fq-active-individual-source" class="wikitable"
 +
|+ Individual sources for quotes
 +
|-
 +
! GnuCash Name !! Finance::Quote Name !! URL, Notes
 +
|-
 +
| AlphaVantage || alphavantage || '''API Key Required'''
 +
<ol>
 +
<li>Register at https://www.alphavantage.co/ and</li>
 +
<li>Store the key which you got there in <tt>Edit->Preferences</tt> tab <tt>Online Quotes</tt>.</li>
 +
</ol>
 +
Watch the restrictions of the Free API Key in their FAQ!
 +
 +
|-
 +
| Amsterdam Euronext eXchange, NL || aex || https://live.euronext.com
 +
includes former sources AEX-“Futures” and -“Options”
 +
 +
|-
 +
| Association of Mutual Funds In India, IN || amfiindia || https://www.amfiindia.com
 +
|-
 +
| Athens Stock Exchange, GR || asegr || https://www.athexgroup.gr
 +
|-
 +
| Australian Stock Exchange, AU || asx || https://www.asx.com.au
 +
Requires at least F::Q 1.41 to get quotes for stocks starting with 'X', like “XRO”, which are not indices.
 +
 +
|-
 +
| Bloomberg || bloomberg || https://www.bloomberg.com
 +
|-
 +
| Italian Stock Exchange, IT || borsa_italiana || https://www.borsaitaliana.it
 +
|-
 +
| BSE India (formerly known as Bombay Stock Exchange Ltd.), IN || bseindia || https://www.bseindia.com
 +
|-
 +
| Bucharest Stock Exchange, RO || bvb or tradeville || https://www.bvb.ro
 +
|-
 +
| Colombo Stock Exchange, LK || cse || https://www.cse.lk
 +
|-
 +
| comdirect, DE || comdirect || https://www.comdirect.de
 +
|-
 +
| Consors Bank, DE || consorsbank || https://www.consorsbank.de
 +
|-
 +
| Deka Investments, DE || deka || https://www.deka.de
 +
|-
 +
| DWS, DE || dwsfunds || https://www.dws.de
 +
|-
 +
| Financial Times Funds service, GB || ftfunds || https://funds.ft.com
 +
|-
 +
| Finanzpartner, DE || finanzpartner || https://www.finanzpartner.de
 +
|-
 +
| FondsWeb, DE || fondsweb || https://www.fondsweb.com
 +
|-
 +
| GoldMoney precious metals || goldmoney || https://www.goldmoney.com
 +
|-
 +
| Google Web, US Stocks || googleweb or bats || https://www.google.com/finance
 +
|-
 +
| IEX (Investors Exchange), US || iexcloud || '''API Key Required'''
 +
<ol>
 +
<li>Register at https://iexcloud.io and</li>
 +
<li>Export the key as <code>IEXCLOUD_API_KEY</code> environment variable before starting GnuCash.</li>
 +
</ol>
 +
Watch the restrictions of the Free API Key in their pricing info!
 +
 +
|-
 +
| MarketWatch || marketwatch || https://www.marketwatch.com
 +
|-
 +
| Morningstar, CH || morningstarch || https://www.morningstar.ch
 +
|-
 +
| Morningstar, GB || morningstaruk or mstaruk || https://morningstar.co.uk
 +
|-
 +
| Morningstar, JP || morningstarjp || https://www.morningstar.co.jp
 +
|-
 +
| Motley Fool, US || fool || https://www.fool.com
 +
|-
 +
| New Zealand stock eXchange, NZ || nzx || https://www.nzx.com
 +
|-
 +
| NSE (National Stock Exchange), IN || nseindia || https://www.nseindia.com
 +
|-
 +
| OnVista, DE || onvista || https://www.onvista.de
 +
|-
 +
| Paris Stock Exchange/Boursorama, FR || bourso || https://www.boursorama.com
 +
|-
 +
| S-Investor, DE || sinvestor || https://web.s-investor.de
 +
|-
 +
| Sharenet, ZA || za || https://www.sharenet.co.za
 +
|-
 +
| SIX Swiss Exchange, CH || six || https://www.six-group.com
 +
includes former sources sixfunds and sixshares
 +
 +
|-
 +
| Skandinaviska Enskilda Banken funds, SE || seb_funds || https://www.seb.se
 +
Consult https://taz.vv.sebank.se/cgi-bin/pts3/pow/Fonder/kurser/kurslista_body.asp  for all available funds.
 +
 +
|-
 +
| StockData || stockdata || '''API Key Required'''
 +
<ol>
 +
<li>Register at https://www.stockdata.org and</li>
 +
<li>Export the key as <code>STOCKDATA_API_KEY</code> environment variable before starting GnuCash.</li>
 +
</ol>
 +
Watch the restrictions of the Free API Key in their pricing info!
 +
 +
|-
 +
| Stooq, PL || stooq || https://stooq.com
 +
|-
 +
| T. Rowe Price, US || troweprice or troweprice_direct || https://www.troweprice.com
 +
|-
 +
| Tesouro Direto bonds, BR || tesouro_direto || https://www.tesourodireto.com.br
 +
|-
 +
| TIAA-CREF, US || tiaacref || https://www.tiaa-cref.org
 +
|-
 +
| Toronto Stock eXchange, CA || tsx or tmx || https://money.tmx.com
 +
|-
 +
| Tradegate, DE || tradegate || Part of https://web.s-investor.de
 +
|-
 +
| Treasury Direct bonds, US || treasurydirect || https://www.treasurydirect.gov
 +
|-
 +
| Twelve Data || twelvedata || '''API Key Required'''
 +
<ol>
 +
<li>Register at https://twelvedata.com and</li>
 +
<li>Export the key as <code>TWELVEDATA_API_KEY</code> environment variable before starting GnuCash.</li>
 +
</ol>
 +
Watch the restrictions of the Free API Key in their pricing info!
 +
 +
|-
 +
| Union Investment, DE || unionfunds || https://www.union-invest.de
 +
|-
 +
| US Govt. Thrift Savings Plan, US || tsp || https://www.tsp.gov
 +
|-
 +
| XETRA, DE || xetra || Part of https://web.s-investor.de
 +
|-
 +
| Yahoo as JSON, US || yahoo_json || https://finance.yahoo.com/  through &quot;JavaScript Object Notation&quot; (query1/v7)
 +
|-
 +
| Yahoo, US || yahooweb || https://finance.yahoo.com/  through &quot;JavaScript Object Notation&quot; (query2/v1)
 +
|-
 +
| YH Finance (FincanceAPI) || financeapi || '''API Key Required'''
 +
<ol>
 +
<li>Register at https://financeapi.net and</li>
 +
<li>Store the key which you got there in <tt>Edit->Preferences</tt> tab <tt>Online Quotes</tt>.</li>
 +
</ol>
 +
Watch the restrictions of the Free API Key in their pricing info!
 +
 +
|}
 +
 +
==== Obsolete Individual Quote Sources ====
 +
 +
{| id="gnc-tbl-fq-obsolete-individual-source" class="wikitable"
 +
|+ Obsolete individual sources for quotes
 +
|-
 +
! GnuCash Name !! Finance::Quote Name !! URL, Notes
 +
|-
 +
| American International Assurance, HK || aiahk || https://www.aia.com.hk
 +
|-
 +
| BAMOSZ funds, HU || bamosz || https://www.bamosz.hu
 +
|-
 +
| BMO NesbittBurns, CA || bmonesbittburns || https://bmonesbittburns.com
 +
|-
 +
| Budapest Stock Exchange (BET), ex-BUX, HU || bse or bet || https://www.bet.hu
 +
|-
 +
| Citywire Funds, GB || citywire || https://citywire.co.uk
 +
|-
 +
| Cominvest Asset Management, ex-Adig, DE || cominvest || The Commerzbank AG changed their structure, use their brand ''comdirect'' now.
 +
|-
 +
| Equinox Unit Trusts, ZA || za_unittrusts || https://www.equinox.co.za
 +
|-
 +
| Fidelity Investments, US || fidelity_direct || https://www.fidelity.com
 +
|-
 +
| Fidelity Fixed, US || fidelityfixed || https://www.fidelity.com/fixed-income-bonds/overview
 +
|-
 +
| Finance Canada || financecanada || https://finance.canada.com
 +
|-
 +
| First Trust Portfolios, US || ftportfolios_direct || https://www.ftportfolios.com
 +
|-
 +
| Fund Library, CA || fundlibrary || https://www.fundlibrary.com
 +
This module uses an id that represents the mutual fund on https://www.fundlibrary.com . There is no easy way of fetching the id except to jump onto the fundlibrary website, look up the fund and view the url for clues to its id number.
 +
 +
|-
 +
| HElsinki stock eXchange, FI || hex || https://www.hex.com
 +
|-
 +
| Man Investments, AU || maninv || https://www.maninvestments.com.au
 +
|-
 +
| Morningstar, SE || morningstar || https://www.morningstar.se
 +
|-
 +
| Paris Stock Exchange/LeRevenu, FR || lerevenu || https://bourse.lerevenu.com
 +
|-
 +
| Platinum Asset Management, AU || platinum || https://www.platinum.com.au
 +
|-
 +
| SIX Swiss Exchange Funds, CH || sixfunds || Part of https://www.six-group.com
 +
|-
 +
| SIX Swiss Exchange Shares, CH || sixshares || Part of https://www.six-group.com
 +
|-
 +
| StockHouse Canada, CA || stockhousecanada_fund || https://www.stockhouse.ca
 +
|-
 +
| TD Waterhouse Funds, CA || tdwaterhouse || https://www.tdassetmanagement.com
 +
|-
 +
| TD Efunds, CA || tdefunds || https://www.tdwaterhouse.ca
 +
|-
 +
| Trustnet via tnetuk.pm, GB || tnetuk || https://www.trustnet.com
 +
|-
 +
| Trustnet via trustnet.pm, GB || trustnet || https://www.trustnet.com
 +
|-
 +
| US Treasury Bonds, US || usfedbonds || https://www.publicdebt.treas.gov
 +
|-
 +
| Vanguard, US || vanguard || part of AlphaVantage
 +
|-
 +
| VWD, DE (unmaintained) || vwd || See https://lists.gnucash.org/pipermail/gnucash-user/2008-February/023686.html
 +
|-
 +
| Yahoo USA
 +
Yahoo Asia
 +
 +
Yahoo Australia
 +
 +
Yahoo Brasil
 +
 +
Yahoo Europe
 +
 +
Yahoo New Zealand
 +
 +
| yahoo
 +
yahoo_asia
 +
 +
yahoo_australia
 +
 +
yahoo_brasil
 +
 +
yahoo_europe
 +
 +
yahoo_nz
 +
 +
| CSV interface since 2017-11-01 shut off
 +
|-
 +
| Yahoo as YQL, US || yahoo_yql || https://finance.yahoo.com/  through &quot;Yahoo Query Language&quot;
 +
|-
 +
| Zuerich Investments (replaced) || zifunds || Zürich Invest has been purchased by Deutsche Bank and integrated into DWS.
 +
|}
 +
 +
=== Finance::Quote Sources - Multiple sources ===
 +
 +
Here the first successful result of a list of sources gets returned.
 +
 +
==== Active Multiple Quote Sources ====
 +
 +
{| id="gnc-tbl-fq-active-multiple-source" class="wikitable"
 +
|+ Multiple sources for quotes
 +
|-
 +
! Name
 +
|-
 +
| Australia (ASX)
 +
|-
 +
| Canada (AlphaVantage, TMX)
 +
|-
 +
| Dutch (AEX)
 +
|-
 +
| Europe (ASEGR, Bourso, BVB, Consorsbank, Sinvestor, Stooq, Tradegate, XETRA)
 +
|-
 +
| France (Bourso)
 +
|-
 +
| Greece (ASEGR)
 +
|-
 +
| India Mutual (AMFI)
 +
|-
 +
| Nasdaq (AlphaVantage, FinanceAPI, Fool, GoogleWeb, IEXCloud, MarketWatch, StockData, YahooJSON)
 +
|-
 +
| NYSE (AlphaVantage, FinanceAPI, Fool, GoogleWeb, IEXCloud, MarketWatch, StockData, YahooJSON)
 +
|-
 +
| Poland (Stooq)
 +
|-
 +
| Romania (BVB)
 +
|-
 +
| South Africa (Sharenet)
 +
|-
 +
| T. Rowe Price
 +
|-
 +
| U.K. Funds (FTfunds, MorningStarUK)
 +
|-
 +
| USA (AlphaVantage, FinanceAPI, Fool, IEXCloud, YahooJSON)
 +
|}
 +
==== Obsolete Multiple Quote Sources ====
 +
 +
{| id="gnc-tbl-fq-obsolete-multiple-source" class="wikitable"
 +
|+ Obsolete Multiple sources for quotes
 +
|-
 +
! Name
 +
|-
 +
| Asia disappeared with Yahoo
 +
|-
 +
| Brasil disappeared with Yahoo
 +
|-
 +
| Fidelity (Fidelity, ...)
 +
|-
 +
| Finland (HEX, ...)
 +
|-
 +
| First Trust (First Trust, ...)
 +
|-
 +
| Hungary (Bamosz, BET, ...)
 +
|-
 +
| New Zealand (NZX, ...)
 +
|-
 +
| U.K. Unit Trusts (trustnet, ...)
 +
|}
 +
 +
Sources: libgnucash/engine/gnc-commodity.cpp [https://github.com/Gnucash/gnucash/pull/2033 Adjusted for Finance::Quote 1.63], [https://wiki.gnucash.org/wiki/ GnuCash-Wiki], [https://bugs.gnucash.org/page.cgi?id=browse.html&product=GnuCash bugzilla], [https://wiki.gnucash.org/wiki/Mailing_Lists#Mailing_List_Archives mailing list archive].
 +
 +
== Details of Some Finance::Quote Sources ==
 +
 +
=== Yahoo Specifics ===
 +
 +
<blockquote>Yahoo has offered quotes from many exchanges and markets. Alphavatage will behave similar but without delay. If you are not asking for US markets, you have to specify where to look. A typical Yahoo symbol has the form {&lt;ISIN&gt;|&lt;ticker&gt;}&lt;market suffix&gt;.
 +
</blockquote>
 +
<div class="note">
 +
 +
<div class="title">
 +
 +
Dots in Ticker Symbols
 +
 +
</div>
 +
Because Yahoo uses the dot . as separator for the market, dots in symbols like in “BT.A” at the [https://www.londonstockexchange.com London Stock Exchange] are replaced by dash - resulting in “BT-A.L”.
 +
 +
 +
</div>
 +
{| id="gnc-tbl-fq-yahoo-exchange-codes" class="wikitable"
 +
|+ Yahoo Codes for Exchanges and Markets
 +
|-
 +
! Country !! Market or Index !! Suffix !! Delay
 +
|-
 +
| Argentina || Buenos Aires Stock Exchange (BYMA) || .BA || 30 min
 +
|-
 +
| Australia || Australian Stock Exchange || .AX || 20 min
 +
|-
 +
| Austria || Vienna Stock Exchange || .VI || 15 min
 +
|-
 +
| Belgium || Euronext Brussels || .BR || 15 min
 +
|-
 +
| Brazil || Sao Paolo Stock Exchange (BOVESPA) || .SA || 15 min
 +
|-
 +
| Canada || Canadian Securities ExchangeToronto Stock Exchange || .CN || 15 min
 +
|-
 +
| Canada || NEO Exchange || .NE || Real-time
 +
|-
 +
| Canada || Toronto Stock Exchange || .TO || 15 min
 +
|-
 +
| Canada || TSX Venture Exchange (TSXV) || .V || 15 min
 +
|-
 +
| Chile || Santiago Stock Exchange || .SN || 15 min
 +
|-
 +
| China || Shanghai Stock Exchange || .SS || 30 min
 +
|-
 +
| China || Shenzhen Stock Exchange || .SZ || 30 min
 +
|-
 +
| Czech Republic || Prague Stock Exchange Index || .PR || 20 min
 +
|-
 +
| Denmark || Nasdaq OMX Copenhagen || .CO || Real-time
 +
|-
 +
| Egypt || Egyptian Exchange Index (EGID) || .CA || 20 min
 +
|-
 +
| Estonia || Nasdaq OMX Tallinn || .TL || Real-time
 +
|-
 +
| Finland || Nasdaq OMX Helsinki || .HE || Real-time
 +
|-
 +
| France || Euronext || .NX || 15 min
 +
|-
 +
| France || Euronext Paris || .PA || 15 min
 +
|-
 +
| Germany || Berlin Stock Exchange || .BE || 15 min
 +
|-
 +
| Germany || Bremen Stock Exchange || .BM || 15 min
 +
|-
 +
| Germany || Dusseldorf Stock Exchange || .DU || 15 min
 +
|-
 +
| Germany || Frankfurt Stock Exchange || .F || 15 min
 +
|-
 +
| Germany || Hamburg Stock Exchange || .HM || 15 min
 +
|-
 +
| Germany || Hanover Stock Exchange || .HA || 15 min
 +
|-
 +
| Germany || Munich Stock Exchange || .MU || 15 min
 +
|-
 +
| Germany || Stuttgart Stock Exchange || .SG || 15 min
 +
|-
 +
| Germany || Deutsche Boerse XETRA || .DE || 15 min
 +
|-
 +
| Global || Currency Rates || =X || Real-time
 +
|-
 +
| Greece || Athens Stock Exchange (ATHEX) || .AT || 15 min
 +
|-
 +
| Hong Kong || Hong Kong Stock Exchange (HKEX) || .HK || 15 min (Real-time in HK)
 +
|-
 +
| Hungary || Budapest Stock Exchange || .BD || 15 min
 +
|-
 +
| Iceland || Nasdaq OMX Iceland || .IC || Real-time
 +
|-
 +
| India || Bombay Stock Exchange || .BO || Real-time
 +
|-
 +
| India || National Stock Exchange of India || .NS || Real-time**
 +
|-
 +
| Indonesia || Indonesia Stock Exchange (IDX) || .JK || 10 min
 +
|-
 +
| Ireland || Euronext Dublin || .IR || 15 min
 +
|-
 +
| Israel || Tel Aviv Stock Exchange || .TA || 20 min
 +
|-
 +
| Italy || EuroTLX || .TI || 20 min
 +
|-
 +
| Italy || Italian Stock Exchange, former Milano || .MI || 20 min
 +
|-
 +
| Japan || Nikkei Indices || N/A || 30 min
 +
|-
 +
| Japan || Tokyo Stock Exchange || .T || 20 min
 +
|-
 +
| Latvia || Nasdaq OMX Riga || .RG || Real-time
 +
|-
 +
| Lithuania || Nasdaq OMX Vilnius || .VS || Real-time
 +
|-
 +
| Malaysia || Malaysian Stock Exchange || .KL || 15 min
 +
|-
 +
| Mexico || Mexico Stock Exchange (BMV) || .MX || 20 min
 +
|-
 +
| Netherlands || Euronext Amsterdam || .AS || 15 min
 +
|-
 +
| New Zealand || New Zealand Stock Exchange (NZX) || .NZ || 20 min
 +
|-
 +
| Norway || Oslo Stock Exchange || .OL || 15 min
 +
|-
 +
| Portugal || Euronext Lisbon || .LS || 15 min
 +
|-
 +
| Qatar || Qatar Stock Exchange || .QA || 15 min
 +
|-
 +
| Russia || Moscow Exchange (MOEX) || .ME || Real-time
 +
|-
 +
| Singapore || Singapore Stock Exchange || .SI || 20 min
 +
|-
 +
| South Africa || Johannesburg Stock Exchange || .Jo || 15 min
 +
|-
 +
| South Korea || Korea Stock Exchange || .KS || 20 min
 +
|-
 +
| South Korea || KOSDAQ || .KQ || 20 min
 +
|-
 +
| Spain || Madrid SE C.A.T.S. || .MC || 15 min
 +
|-
 +
| Saudi Arabia || Saudi Stock Exchange (Tadawul) || .SAU || 15 min
 +
|-
 +
| Sweden || Nasdaq OMX Stockholm || .ST || Real-time
 +
|-
 +
| Switzerland || Swiss Exchange (SIX) || .SW || 30 min
 +
|-
 +
| Taiwan || Taiwan OTC Exchange || .TWO || 20 min
 +
|-
 +
| Taiwan || Taiwan Stock Exchange (TWSE) || .TW || 20 min
 +
|-
 +
| Thailand || Stock Exchange of Thailand (SET) || .BK || 15 min
 +
|-
 +
| Turkey || Borsa İstanbul || .IS || 15 min
 +
|-
 +
| United Kingdom || FTSE Indices || N/A || 15 min
 +
|-
 +
| United Kingdom || London Stock Exchange || .L || 20 min
 +
|-
 +
| United Kingdom || London Stock Exchange || .IL || 20 min
 +
|-
 +
| United States of America || Chicago Board of Trade (CBOT) || .CBT || 10 min
 +
|-
 +
| United States of America || Chicago Mercantile Exchange (CME) || .CME || 10 min
 +
|-
 +
| United States of America || Dow Jones Indexes || N/A || Real-time
 +
|-
 +
| United States of America || NASDAQ Stock Exchange || N/A || Real-time*
 +
|-
 +
| United States of America || ICE Futures US, former New York Board of Trade || .NYB || 30 min
 +
|-
 +
| United States of America || New York Commodities Exchange (COMEX) || .CMX || 30 min
 +
|-
 +
| United States of America || New York Mercantile Exchange (NYMEX) || .NYM || 30 min
 +
|-
 +
| United States of America || Options Price Reporting Authority (OPRA) || N/A || 15 min
 +
|-
 +
| United States of America || OTC Bulletin Board Market || N/A || Real-time
 +
|-
 +
| United States of America || OTC Markets Group || N/A || 15 min
 +
|-
 +
| United States of America || S &amp; P Indices || N/A || Real-time
 +
|-
 +
| Venezuela || Caracas Stock Exchange || .CR || 15 min
 +
|}
 +
 +
Source: https://help.yahoo.com/kb/SLN2310.html?redirect=true  queried at 2020-04-14.
 +
 +
<span id="fq-spec-tiaa"></span>
 +
=== TIAA-CREF Specifics ===
 +
 +
<blockquote>TIAA-CREF Annuities are not listed on any exchange, unlike their mutual funds TIAA-CREF provides unit values via a cgi on their website. The cgi returns a csv file in the format
 +
 +
<pre class="csv">bogus_symbol1,price1,date1
 +
            bogus_symbol2,price2,date2
 +
            …</pre>
 +
where &lt;bogus_symbol&gt; takes on the following values for the various annuities:
 +
</blockquote>
 +
<div class="note">
 +
 +
<div class="title">
 +
 +
 +
 +
</div>
 +
The symbols are case-sensitive and changed their capitalization in the last time.
 +
 +
 +
</div>
 +
{| id="PsSymbs-TIAA-CREF" class="wikitable"
 +
|+ Pseudo-symbols that can be used for TIAA-CREF quotes
 +
|-
 +
! style="text-align: center;"| Name !! style="text-align: center;"| Symbol !! style="text-align: center;"| bogus
 +
|-
 +
| CREF Bond Market Account || CREFbond || style="text-align: right;"| 41081991
 +
|-
 +
| CREF Equity Index Account || CREFequi || style="text-align: right;"| 41082540
 +
|-
 +
| CREF Global Equities Account || CREFglob || style="text-align: right;"| 41081992
 +
|-
 +
| CREF Growth Account || CREFgrow || style="text-align: right;"| 41082544
 +
|-
 +
| CREF Inflation-Linked Bond Account || CREFinfb || style="text-align: right;"| 41088773
 +
|-
 +
| CREF Money Market Account || CREFmony || style="text-align: right;"| 41081993
 +
|-
 +
| CREF Social Choice Account || CREFsoci || style="text-align: right;"| 41081994
 +
|-
 +
| CREF Stock Account || CREFstok || style="text-align: right;"| 41081995
 +
|-
 +
| TIAA Real Estate Account || TIAAreal || style="text-align: right;"| 41091375
 +
|-
 +
| TIAA-CREF Bond Fund (Retirement) || TIDRX || style="text-align: right;"| 4530828
 +
|-
 +
| TIAA-CREF Bond Index Fund (Retirement) || TBIRX || style="text-align: right;"| 20739662
 +
|-
 +
| TIAA-CREF Bond Plus Fund (Retirement) || TCBRX || style="text-align: right;"| 4530816
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Fund (Retirement) || TEMSX || style="text-align: right;"| 26176543
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Index Fund (Retirement) || TEQSX || style="text-align: right;"| 26176547
 +
|-
 +
| TIAA-CREF Equity Index Fund (Retirement) || TIQRX || style="text-align: right;"| 4530786
 +
|-
 +
| TIAA-CREF Global Natural Resources Fund (Retirement) || TNRRX || style="text-align: right;"| 39444919
 +
|-
 +
| TIAA-CREF Growth &amp; Income Fund (Retirement) || TRGIX || style="text-align: right;"| 312536
 +
|-
 +
| TIAA-CREF High Yield Fund (Retirement) || TIHRX || style="text-align: right;"| 4530821
 +
|-
 +
| TIAA-CREF Inflation-Linked Bond Fund (Retirement) || TIKRX || style="text-align: right;"| 4530829
 +
|-
 +
| TIAA-CREF International Equity Fund (Retirement) || TRERX || style="text-align: right;"| 302323
 +
|-
 +
| TIAA-CREF International Equity Index Fund (Retirement) || TRIEX || style="text-align: right;"| 300269
 +
|-
 +
| TIAA-CREF Large-Cap Growth Fund (Retirement) || TILRX || style="text-align: right;"| 4530785
 +
|-
 +
| TIAA-CREF Large-Cap Growth Index Fund (Retirement) || TRIRX || style="text-align: right;"| 299525
 +
|-
 +
| TIAA-CREF Large-Cap Value Fund (Retirement) || TRLCX || style="text-align: right;"| 301332
 +
|-
 +
| TIAA-CREF Large-Cap Value Index Fund (Retirement) || TRCVX || style="text-align: right;"| 304333
 +
|-
 +
| TIAA-CREF Lifecycle 2010 Fund (Retirement) || TCLEX || style="text-align: right;"| 302817
 +
|-
 +
| TIAA-CREF Lifecycle 2015 Fund (Retirement) || TCLIX || style="text-align: right;"| 302393
 +
|-
 +
| TIAA-CREF Lifecycle 2020 Fund (Retirement) || TCLTX || style="text-align: right;"| 307774
 +
|-
 +
| TIAA-CREF Lifecycle 2025 Fund (Retirement) || TCLFX || style="text-align: right;"| 313994
 +
|-
 +
| TIAA-CREF Lifecycle 2030 Fund (Retirement) || TCLNX || style="text-align: right;"| 307240
 +
|-
 +
| TIAA-CREF Lifecycle 2035 Fund (Retirement) || TCLRX || style="text-align: right;"| 309003
 +
|-
 +
| TIAA-CREF Lifecycle 2040 Fund (Retirement) || TCLOX || style="text-align: right;"| 300959
 +
|-
 +
| TIAA-CREF Lifecycle 2045 Fund (Retirement) || TTFRX || style="text-align: right;"| 9467597
 +
|-
 +
| TIAA-CREF Lifecycle 2050 Fund (Retirement) || TLFRX || style="text-align: right;"| 9467596
 +
|-
 +
| TIAA-CREF Lifecycle 2055 Fund (Retirement) || TTRLX || style="text-align: right;"| 34211330
 +
|-
 +
| TIAA-CREF Lifecycle Index 2010 Fund (Retirement) || TLTRX || style="text-align: right;"| 21066482
 +
|-
 +
| TIAA-CREF Lifecycle Index 2015 Fund (Retirement) || TLGRX || style="text-align: right;"| 21066496
 +
|-
 +
| TIAA-CREF Lifecycle Index 2020 Fund (Retirement) || TLWRX || style="text-align: right;"| 21066479
 +
|-
 +
| TIAA-CREF Lifecycle Index 2025 Fund (Retirement) || TLQRX || style="text-align: right;"| 21066485
 +
|-
 +
| TIAA-CREF Lifecycle Index 2030 Fund (Retirement) || TLHRX || style="text-align: right;"| 21066435
 +
|-
 +
| TIAA-CREF Lifecycle Index 2035 Fund (Retirement) || TLYRX || style="text-align: right;"| 21066475
 +
|-
 +
| TIAA-CREF Lifecycle Index 2040 Fund (Retirement) || TLZRX || style="text-align: right;"| 21066473
 +
|-
 +
| TIAA-CREF Lifecycle Index 2045 Fund (Retirement) || TLMRX || style="text-align: right;"| 21066488
 +
|-
 +
| TIAA-CREF Lifecycle Index 2050 Fund (Retirement) || TLLRX || style="text-align: right;"| 21066490
 +
|-
 +
| TIAA-CREF Lifecycle Index 2055 Fund (Retirement) || TTIRX || style="text-align: right;"| 34211328
 +
|-
 +
| TIAA-CREF Lifecycle Index Retirement Income Fund (Retirement) || TRCIX || style="text-align: right;"| 21066468
 +
|-
 +
| TIAA-CREF Lifecycle Retirement Income Fund (Retirement) || TLIRX || style="text-align: right;"| 9467594
 +
|-
 +
| TIAA-CREF Lifestyle Aggressive Growth Fund (Retirement) || TSARX || style="text-align: right;"| 40508431
 +
|-
 +
| TIAA-CREF Lifestyle Conservative Fund (Retirement) || TSCTX || style="text-align: right;"| 40508433
 +
|-
 +
| TIAA-CREF Lifestyle Growth Fund (Retirement) || TSGRX || style="text-align: right;"| 40508437
 +
|-
 +
| TIAA-CREF Lifestyle Income Fund (Retirement) || TLSRX || style="text-align: right;"| 40508427
 +
|-
 +
| TIAA-CREF Lifestyle Moderate Fund (Retirement) || TSMTX || style="text-align: right;"| 40508460
 +
|-
 +
| TIAA-CREF Managed Allocation Fund (Retirement) || TITRX || style="text-align: right;"| 4530825
 +
|-
 +
| TIAA-CREF Mid-Cap Growth Fund (Retirement) || TRGMX || style="text-align: right;"| 305499
 +
|-
 +
| TIAA-CREF Mid-Cap Value Fund (Retirement) || TRVRX || style="text-align: right;"| 315272
 +
|-
 +
| TIAA-CREF Money Market Fund (Retirement) || TIEXX || style="text-align: right;"| 4530771
 +
|-
 +
| TIAA-CREF Real Estate Securities Fund (Retirement) || TRRSX || style="text-align: right;"| 300081
 +
|-
 +
| TIAA-CREF S&amp;P 500 Index Fund (Retirement) || TRSPX || style="text-align: right;"| 306105
 +
|-
 +
| TIAA-CREF Short-Term Bond Fund (Retirement) || TISRX || style="text-align: right;"| 4530818
 +
|-
 +
| TIAA-CREF Small-Cap Blend Index Fund (Retirement) || TRBIX || style="text-align: right;"| 314644
 +
|-
 +
| TIAA-CREF Small-Cap Equity Fund (Retirement) || TRSEX || style="text-align: right;"| 299968
 +
|-
 +
| TIAA-CREF Social Choice Equity Fund (Retirement) || TRSCX || style="text-align: right;"| 300078
 +
|-
 +
| TIAA-CREF Bond Fund (Institutional) || TIBDX || style="text-align: right;"| 307276
 +
|-
 +
| TIAA-CREF Bond Index Fund (Institutional) || TBIIX || style="text-align: right;"| 20739664
 +
|-
 +
| TIAA-CREF Bond Plus Fund (Institutional) || TIBFX || style="text-align: right;"| 4530820
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Fund (Institutional) || TEMLX || style="text-align: right;"| 26176540
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Index Fund (Institutional) || TEQLX || style="text-align: right;"| 26176544
 +
|-
 +
| TIAA-CREF Enhanced International Equity Index Fund (Institutional) || TFIIX || style="text-align: right;"| 9467603
 +
|-
 +
| TIAA-CREF Enhanced Large-Cap Growth Index Fund (Institutional) || TLIIX || style="text-align: right;"| 9467602
 +
|-
 +
| TIAA-CREF Enhanced Large-Cap Value Index Fund (Institutional) || TEVIX || style="text-align: right;"| 9467606
 +
|-
 +
| TIAA-CREF Equity Index Fund (Institutional) || TIEIX || style="text-align: right;"| 301718
 +
|-
 +
| TIAA-CREF Global Natural Resources Fund (Institutional) || TNRIX || style="text-align: right;"| 39444916
 +
|-
 +
| TIAA-CREF Growth &amp; Income Fund (Institutional) || TIGRX || style="text-align: right;"| 314719
 +
|-
 +
| TIAA-CREF High Yield Fund (Institutional) || TIHYX || style="text-align: right;"| 4530798
 +
|-
 +
| TIAA-CREF Inflation-Linked Bond Fund (Institutional) || TIILX || style="text-align: right;"| 316693
 +
|-
 +
| TIAA-CREF International Equity Fund (Institutional) || TIIEX || style="text-align: right;"| 305980
 +
|-
 +
| TIAA-CREF International Equity Index Fund (Institutional) || TCIEX || style="text-align: right;"| 303673
 +
|-
 +
| TIAA-CREF Large-Cap Growth Fund (Institutional) || TILGX || style="text-align: right;"| 4530800
 +
|-
 +
| TIAA-CREF Large-Cap Growth Index Fund (Institutional) || TILIX || style="text-align: right;"| 297809
 +
|-
 +
| TIAA-CREF Large-Cap Value Fund (Institutional) || TRLIX || style="text-align: right;"| 300692
 +
|-
 +
| TIAA-CREF Large-Cap Value Index Fund (Institutional) || TILVX || style="text-align: right;"| 302308
 +
|-
 +
| TIAA-CREF Lifecycle 2010 Fund (Institutional) || TCTIX || style="text-align: right;"| 4912376
 +
|-
 +
| TIAA-CREF Lifecycle 2015 Fund (Institutional) || TCNIX || style="text-align: right;"| 4912355
 +
|-
 +
| TIAA-CREF Lifecycle 2020 Fund (Institutional) || TCWIX || style="text-align: right;"| 4912377
 +
|-
 +
| TIAA-CREF Lifecycle 2025 Fund (Institutional) || TCYIX || style="text-align: right;"| 4912384
 +
|-
 +
| TIAA-CREF Lifecycle 2030 Fund (Institutional) || TCRIX || style="text-align: right;"| 4912364
 +
|-
 +
| TIAA-CREF Lifecycle 2035 Fund (Institutional) || TCIIX || style="text-align: right;"| 4912375
 +
|-
 +
| TIAA-CREF Lifecycle 2040 Fund (Institutional) || TCOIX || style="text-align: right;"| 4912387
 +
|-
 +
| TIAA-CREF Lifecycle 2045 Fund (Institutional) || TTFIX || style="text-align: right;"| 9467607
 +
|-
 +
| TIAA-CREF Lifecycle 2050 Fund (Institutional) || TFTIX || style="text-align: right;"| 9467601
 +
|-
 +
| TIAA-CREF Lifecycle 2055 Fund (Institutional) || TTRIX || style="text-align: right;"| 34211329
 +
|-
 +
| TIAA-CREF Lifecycle Index 2010 Fund (Institutional) || TLTIX || style="text-align: right;"| 21066484
 +
|-
 +
| TIAA-CREF Lifecycle Index 2015 Fund (Institutional) || TLFIX || style="text-align: right;"| 21066498
 +
|-
 +
| TIAA-CREF Lifecycle Index 2020 Fund (Institutional) || TLWIX || style="text-align: right;"| 21066480
 +
|-
 +
| TIAA-CREF Lifecycle Index 2025 Fund (Institutional) || TLQIX || style="text-align: right;"| 21066486
 +
|-
 +
| TIAA-CREF Lifecycle Index 2030 Fund (Institutional) || TLHIX || style="text-align: right;"| 21066495
 +
|-
 +
| TIAA-CREF Lifecycle Index 2035 Fund (Institutional) || TLYIX || style="text-align: right;"| 21066477
 +
|-
 +
| TIAA-CREF Lifecycle Index 2040 Fund (Institutional) || TLZIX || style="text-align: right;"| 21066474
 +
|-
 +
| TIAA-CREF Lifecycle Index 2045 Fund (Institutional) || TLXIX || style="text-align: right;"| 21066478
 +
|-
 +
| TIAA-CREF Lifecycle Index 2050 Fund (Institutional) || TLLIX || style="text-align: right;"| 21066492
 +
|-
 +
| TIAA-CREF Lifecycle Index 2055 Fund (Institutional) || TTIIX || style="text-align: right;"| 34211326
 +
|-
 +
| TIAA-CREF Lifecycle Index Retirement Income Fund (Institutional) || TRILX || style="text-align: right;"| 21066463
 +
|-
 +
| TIAA-CREF Lifecycle Retirement Income Fund (Institutional) || TLRIX || style="text-align: right;"| 9467595
 +
|-
 +
| TIAA-CREF Lifestyle Aggressive Growth Fund (Institutional) || TSAIX || style="text-align: right;"| 40508428
 +
|-
 +
| TIAA-CREF Lifestyle Conservative Fund (Institutional) || TCSIX || style="text-align: right;"| 40508425
 +
|-
 +
| TIAA-CREF Lifestyle Growth Fund (Institutional) || TSGGX || style="text-align: right;"| 40508434
 +
|-
 +
| TIAA-CREF Lifestyle Income Fund (Institutional) || TSITX || style="text-align: right;"| 40508450
 +
|-
 +
| TIAA-CREF Lifestyle Moderate Fund (Institutional) || TSIMX || style="text-align: right;"| 40508443
 +
|-
 +
| TIAA-CREF Managed Allocation Fund (Institutional) || TIMIX || style="text-align: right;"| 4530787
 +
|-
 +
| TIAA-CREF Mid-Cap Growth Fund (Institutional) || TRPWX || style="text-align: right;"| 297210
 +
|-
 +
| TIAA-CREF Mid-Cap Value Fund (Institutional) || TIMVX || style="text-align: right;"| 316178
 +
|-
 +
| TIAA-CREF Money Market Fund (Institutional) || TCIXX || style="text-align: right;"| 313650
 +
|-
 +
| TIAA-CREF Real Estate Securities Fund (Institutional) || TIREX || style="text-align: right;"| 303475
 +
|-
 +
| TIAA-CREF S&amp;P 500 Index Fund (Institutional) || TISPX || style="text-align: right;"| 306658
 +
|-
 +
| TIAA-CREF Short-Term Bond Fund (Institutional) || TISIX || style="text-align: right;"| 4530784
 +
|-
 +
| TIAA-CREF Small-Cap Blend Index Fund (Institutional) || TISBX || style="text-align: right;"| 309018
 +
|-
 +
| TIAA-CREF Small-Cap Equity Fund (Institutional) || TISEX || style="text-align: right;"| 301622
 +
|-
 +
| TIAA-CREF Social Choice Equity Fund (Institutional) || TISCX || style="text-align: right;"| 301897
 +
|-
 +
| TIAA-CREF Tax-Exempt Bond Fund (Institutional) || TITIX || style="text-align: right;"| 4530819
 +
|-
 +
| TIAA-CREF Bond Fund (Retail) || TIORX || style="text-align: right;"| 4530794
 +
|-
 +
| TIAA-CREF Bond Index Fund (Retail) || TBILX || style="text-align: right;"| 20739663
 +
|-
 +
| TIAA-CREF Bond Plus Fund (Retail) || TCBPX || style="text-align: right;"| 4530788
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Fund (Retail) || TEMRX || style="text-align: right;"| 26176542
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Index Fund (Retail) || TEQKX || style="text-align: right;"| 26176545
 +
|-
 +
| TIAA-CREF Equity Index Fund (Retail) || TINRX || style="text-align: right;"| 4530797
 +
|-
 +
| TIAA-CREF Global Natural Resources Fund (Retail) || TNRLX || style="text-align: right;"| 39444917
 +
|-
 +
| TIAA-CREF Growth &amp; Income Fund (Retail) || TIIRX || style="text-align: right;"| 4530790
 +
|-
 +
| TIAA-CREF High Yield Fund (Retail) || TIYRX || style="text-align: right;"| 4530830
 +
|-
 +
| TIAA-CREF Inflation-Linked Bond Fund (Retail) || TCILX || style="text-align: right;"| 313727
 +
|-
 +
| TIAA-CREF International Equity Fund (Retail) || TIERX || style="text-align: right;"| 4530827
 +
|-
 +
| TIAA-CREF Large-Cap Growth Fund (Retail) || TIRTX || style="text-align: right;"| 4530791
 +
|-
 +
| TIAA-CREF Large-Cap Value Fund (Retail) || TCLCX || style="text-align: right;"| 302696
 +
|-
 +
| TIAA-CREF Lifecycle Retirement Income Fund (Retail) || TLRRX || style="text-align: right;"| 9467600
 +
|-
 +
| TIAA-CREF Lifestyle Aggressive Growth Fund (Retail) || TSALX || style="text-align: right;"| 40508429
 +
|-
 +
| TIAA-CREF Lifestyle Conservative Fund (Retail) || TSCLX || style="text-align: right;"| 40508432
 +
|-
 +
| TIAA-CREF Lifestyle Growth Fund (Retail) || TSGLX || style="text-align: right;"| 40508435
 +
|-
 +
| TIAA-CREF Lifestyle Income Fund (Retail) || TSILX || style="text-align: right;"| 40508438
 +
|-
 +
| TIAA-CREF Lifestyle Moderate Fund (Retail) || TSMLX || style="text-align: right;"| 40508453
 +
|-
 +
| TIAA-CREF Managed Allocation Fund (Retail) || TIMRX || style="text-align: right;"| 4530817
 +
|-
 +
| TIAA-CREF Mid-Cap Growth Fund (Retail) || TCMGX || style="text-align: right;"| 305208
 +
|-
 +
| TIAA-CREF Mid-Cap Value Fund (Retail) || TCMVX || style="text-align: right;"| 313995
 +
|-
 +
| TIAA-CREF Money Market Fund (Retail) || TIRXX || style="text-align: right;"| 4530775
 +
|-
 +
| TIAA-CREF Real Estate Securities Fund (Retail) || TCREX || style="text-align: right;"| 309567
 +
|-
 +
| TIAA-CREF Short-Term Bond Fund (Retail) || TCTRX || style="text-align: right;"| 4530822
 +
|-
 +
| TIAA-CREF Small-Cap Equity Fund (Retail) || TCSEX || style="text-align: right;"| 297477
 +
|-
 +
| TIAA-CREF Social Choice Equity Fund (Retail) || TICRX || style="text-align: right;"| 4530792
 +
|-
 +
| TIAA-CREF Tax-Exempt Bond Fund (Retail) || TIXRX || style="text-align: right;"| 4530793
 +
|-
 +
| TIAA-CREF Bond Fund (Premier) || TIDPX || style="text-align: right;"| 21066506
 +
|-
 +
| TIAA-CREF Bond Index Fund (Premier) || TBIPX || style="text-align: right;"| 21066534
 +
|-
 +
| TIAA-CREF Bond Plus Fund (Premier) || TBPPX || style="text-align: right;"| 21066533
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Fund (Premier) || TEMPX || style="text-align: right;"| 26176541
 +
|-
 +
| TIAA-CREF Emerging Markets Equity Index Fund (Premier) || TEQPX || style="text-align: right;"| 26176546
 +
|-
 +
| TIAA-CREF Equity Index Fund (Premier) || TCEPX || style="text-align: right;"| 21066530
 +
|-
 +
| TIAA-CREF Global Natural Resources Fund (Premier) || TNRPX || style="text-align: right;"| 39444918
 +
|-
 +
| TIAA-CREF Growth &amp; Income Fund (Premier) || TRPGX || style="text-align: right;"| 21066461
 +
|-
 +
| TIAA-CREF High Yield Fund (Premier) || TIHPX || style="text-align: right;"| 21066501
 +
|-
 +
| TIAA-CREF Inflation-Linked Bond Fund (Premier) || TIKPX || style="text-align: right;"| 21066500
 +
|-
 +
| TIAA-CREF International Equity Fund (Premier) || TREPX || style="text-align: right;"| 21066466
 +
|-
 +
| TIAA-CREF International Equity Index Fund (Premier) || TRIPX || style="text-align: right;"| 21066462
 +
|-
 +
| TIAA-CREF Large-Cap Growth Fund (Premier) || TILPX || style="text-align: right;"| 21066499
 +
|-
 +
| TIAA-CREF Large-Cap Value Fund (Premier) || TRCPX || style="text-align: right;"| 21066467
 +
|-
 +
| TIAA-CREF Lifecycle 2010 Fund (Premier) || TCTPX || style="text-align: right;"| 21066521
 +
|-
 +
| TIAA-CREF Lifecycle 2015 Fund (Premier) || TCFPX || style="text-align: right;"| 21066528
 +
|-
 +
| TIAA-CREF Lifecycle 2020 Fund (Premier) || TCWPX || style="text-align: right;"| 21066518
 +
|-
 +
| TIAA-CREF Lifecycle 2025 Fund (Premier) || TCQPX || style="text-align: right;"| 21066522
 +
|-
 +
| TIAA-CREF Lifecycle 2030 Fund (Premier) || TCHPX || style="text-align: right;"| 21066527
 +
|-
 +
| TIAA-CREF Lifecycle 2035 Fund (Premier) || TCYPX || style="text-align: right;"| 21066517
 +
|-
 +
| TIAA-CREF Lifecycle 2040 Fund (Premier) || TCZPX || style="text-align: right;"| 21066516
 +
|-
 +
| TIAA-CREF Lifecycle 2045 Fund (Premier) || TTFPX || style="text-align: right;"| 21066444
 +
|-
 +
| TIAA-CREF Lifecycle 2050 Fund (Premier) || TCLPX || style="text-align: right;"| 21066526
 +
|-
 +
| TIAA-CREF Lifecycle 2055 Fund (Premier) || TTRPX || style="text-align: right;"| 34211331
 +
|-
 +
| TIAA-CREF Lifecycle Index 2010 Fund (Premier) || TLTPX || style="text-align: right;"| 21066483
 +
|-
 +
| TIAA-CREF Lifecycle Index 2015 Fund (Premier) || TLFPX || style="text-align: right;"| 21066497
 +
|-
 +
| TIAA-CREF Lifecycle Index 2020 Fund (Premier) || TLWPX || style="text-align: right;"| 21066434
 +
|-
 +
| TIAA-CREF Lifecycle Index 2025 Fund (Premier) || TLVPX || style="text-align: right;"| 21066481
 +
|-
 +
| TIAA-CREF Lifecycle Index 2030 Fund (Premier) || TLHPX || style="text-align: right;"| 21066494
 +
|-
 +
| TIAA-CREF Lifecycle Index 2035 Fund (Premier) || TLYPX || style="text-align: right;"| 21066476
 +
|-
 +
| TIAA-CREF Lifecycle Index 2040 Fund (Premier) || TLPRX || style="text-align: right;"| 21066487
 +
|-
 +
| TIAA-CREF Lifecycle Index 2045 Fund (Premier) || TLMPX || style="text-align: right;"| 21066489
 +
|-
 +
| TIAA-CREF Lifecycle Index 2050 Fund (Premier) || TLLPX || style="text-align: right;"| 21066491
 +
|-
 +
| TIAA-CREF Lifecycle Index 2055 Fund (Premier) || TTIPX || style="text-align: right;"| 34211327
 +
|-
 +
| TIAA-CREF Lifecycle Index Retirement Income Fund (Premier) || TLIPX || style="text-align: right;"| 21066493
 +
|-
 +
| TIAA-CREF Lifecycle Retirement Income Fund (Premier) || TPILX || style="text-align: right;"| 21066470
 +
|-
 +
| TIAA-CREF Lifestyle Aggressive Growth Fund (Premier) || TSAPX || style="text-align: right;"| 40508430
 +
|-
 +
| TIAA-CREF Lifestyle Conservative Fund (Premier) || TLSPX || style="text-align: right;"| 40508426
 +
|-
 +
| TIAA-CREF Lifestyle Growth Fund (Premier) || TSGPX || style="text-align: right;"| 40508436
 +
|-
 +
| TIAA-CREF Lifestyle Income Fund (Premier) || TSIPX || style="text-align: right;"| 40508451
 +
|-
 +
| TIAA-CREF Lifestyle Moderate Fund (Premier) || TSMPX || style="text-align: right;"| 40508456
 +
|-
 +
| TIAA-CREF Mid-Cap Growth Fund (Premier) || TRGPX || style="text-align: right;"| 21066464
 +
|-
 +
| TIAA-CREF Mid-Cap Value Fund (Premier) || TRVPX || style="text-align: right;"| 21066455
 +
|-
 +
| TIAA-CREF Money Market Fund (Premier) || TPPXX || style="text-align: right;"| 21066469
 +
|-
 +
| TIAA-CREF Real Estate Securities Fund (Premier) || TRRPX || style="text-align: right;"| 21066459
 +
|-
 +
| TIAA-CREF Short-Term Bond Fund (Premier) || TSTPX || style="text-align: right;"| 21066445
 +
|-
 +
| TIAA-CREF Small-Cap Equity Fund (Premier) || TSRPX || style="text-align: right;"| 21066446
 +
|-
 +
| TIAA-CREF Social Choice Equity Fund (Premier) || TRPSX || style="text-align: right;"| 21066460
 +
|}
 +
 +
Source: Comments in https://rt.cpan.org/Ticket/Attachment/1121440/589997/Tiaacref.pm.zip
 +
  
 
==Updating enabled Quotes from outside GnuCash==
 
==Updating enabled Quotes from outside GnuCash==
Line 516: Line 1,648:
  
 
The Apple-supplied Perl installation has the Perl executable at <tt>/usr/bin/perl</tt>.  
 
The Apple-supplied Perl installation has the Perl executable at <tt>/usr/bin/perl</tt>.  
It stores modules at <tt>/Library/Perl/5.xx/Finance</tt>, where <tt>xx</tt> depends on the version of Perl in use when you installed Finanace::Quote.
+
It stores modules at <tt>/Library/Perl/5.xx/Finance</tt>, where <tt>xx</tt> depends on the version of Perl in use when you installed Finance::Quote.
  
 
Install Finance::Quote to the system location using <Syntaxhighlight lang="sh">
 
Install Finance::Quote to the system location using <Syntaxhighlight lang="sh">
Line 525: Line 1,657:
  
 
When you upgrade {{Mac}}, you may have to reinstall Finance::Quote. This is because the newer {{Mac}} version may have a newer Perl version, which will have a different <tt>xx</tt> in the path to the module storage location. The older version directories are not included in Perl's path to this location (via <tt>@INC</tt>).
 
When you upgrade {{Mac}}, you may have to reinstall Finance::Quote. This is because the newer {{Mac}} version may have a newer Perl version, which will have a different <tt>xx</tt> in the path to the module storage location. The older version directories are not included in Perl's path to this location (via <tt>@INC</tt>).
 +
 +
For {{Mac}} Version 11.6 (Big Sur) Finance::Quote may be inoperable due to missing modules. Use the following commands to correct the problem:
 +
<Syntaxhighlight lang="sh">
 +
sudo cpan -i B::Keywords
 +
sudo cpan -i Test2
 +
sudo cpan -i DateTime
 +
sudo cpan -i DateTime::Locale
 +
sudo cpan -i DateTime::Format::Strptime
 +
sudo cpan -i Mozilla::CA
 +
</Syntaxhighlight>
 +
Once these modules have been installed, it's probably best to repeat the GnuCash supplied installation again
 +
<Syntaxhighlight lang="sh">
 +
cd /Applications/Gnucash/Contents/Resources/bin
 +
sudo ./gnc-fq-update
 +
</Syntaxhighlight>
  
 
If you have installed Perl via [https://www.macports.org/ MacPorts] or [https://brew.sh/ Homebrew], you probably have multiple Perl installations on your system. Each installation has its own set of modules. You may need to install Finance::Quote in each of these locations. See '''[[#Multiple_Perl_installations_on_{{Mac}}|Multiple Perl installations on {{Mac}}]]''' above for advice.
 
If you have installed Perl via [https://www.macports.org/ MacPorts] or [https://brew.sh/ Homebrew], you probably have multiple Perl installations on your system. Each installation has its own set of modules. You may need to install Finance::Quote in each of these locations. See '''[[#Multiple_Perl_installations_on_{{Mac}}|Multiple Perl installations on {{Mac}}]]''' above for advice.
Line 531: Line 1,678:
  
 
MacPorts has a port <tt>p5-finance-quote</tt>. Install this port to make Finance::Quote available to the MacPorts-supplied Perl installation: <Syntaxhighlight lang="sh">
 
MacPorts has a port <tt>p5-finance-quote</tt>. Install this port to make Finance::Quote available to the MacPorts-supplied Perl installation: <Syntaxhighlight lang="sh">
sudo port install p5-finance-port
+
sudo port install p5-finance-quote
 
</Syntaxhighlight>  
 
</Syntaxhighlight>  
 
Within <tt>p5-finance-quote</tt> are subports specific to Perl versions, e.g. <tt>p5.26-finance-quote</tt> and <tt>p5.28-finance-quote</tt>. It is these subports which actually install the Finance::Quote module. When you install <tt>p5-finance-quote</tt>, MacPorts installs the appropriate subports, and necessary other Perl modules.  
 
Within <tt>p5-finance-quote</tt> are subports specific to Perl versions, e.g. <tt>p5.26-finance-quote</tt> and <tt>p5.28-finance-quote</tt>. It is these subports which actually install the Finance::Quote module. When you install <tt>p5-finance-quote</tt>, MacPorts installs the appropriate subports, and necessary other Perl modules.  
Line 547: Line 1,694:
  
 
== Trouble Shooting ==
 
== Trouble Shooting ==
 +
 +
See [[#Command Line Interface|Command Line Interface]] above for more information on using <tt>gnucash-cli</tt> on your platform.
 +
 +
==== GnuCash 5.x and newer ====
 +
 +
===== The Get Quotes button in Price Editor isn't enabled =====
 +
This can also manifest as a warning about Finance Quote not being installed correctly in Security Editor dialog boxes. Run
 +
  gnucash-cli --quotes info
 +
If it presents its usual output then there is something different about the perl environment in the terminal shell than when starting GnuCash from the Desktop. Try running <tt>gnucash</tt> from the terminal, using the same path if any that you use for <tt>gnucash-cli</tt> (''exception'': on {{mac}} it's capitalized, i.e. <tt>/Applications/Gnucash.app/Contents/{{mac}}/Gnucash</tt>). If that works, look for environment differences between the desktop environment and your shell environment, paying particular attention to <tt>$PATH</tt> and <tt>$PERL5DOC</tt>.
 +
 +
If instead you get a bunch of errors there's something wrong with your Finance::Quote installation. The errors might offer a clue: For example, you might find
 +
  Can't locate DateTime/Format/Strptime.pm in @INC (you may need to install the DateTime::Format::Strptime module)
 +
and you can use
 +
  sudo cpan -i DateTime::Format::Strptime
 +
to install it. {{mac}} users with Apple Silicon Macs should see [#Installing Finance::Quote on {{mac}} from a Terminal prompt] for special considerations. Microsoft Windows users should use the cpan shell from the Start menu's Strawberry Perl folder and tell it
 +
    install DateTime::Format::Strptime
 +
If you need help understanding the errors, ask on one of the [[Mailing Lists#User Lists| user mailing lists]].
 +
 +
===== Get Quotes fails for some symbols =====
 +
 +
Run
 +
    gnucash-cli --quotes dump <source> <symbol>
 +
substituting the symbol and its source in the indicated places, for example
 +
    gnucash-cli --quotes dump fool AAPL
 +
to retrieve a quote for Apple, Inc. from the Motley Fool website. A successful retrieval will look like
 +
    Finance::Quote fields GnuCash uses:
 +
        symbol: AAPL            <=== required
 +
          date: 12/22/2023      <=== recommended
 +
      currency: USD            <=== required
 +
          last: 193.60          <=\
 +
          nav:                <=== one of these
 +
        price:                <=/
 +
A failure will return a similar block with required fields empty or an error message like
 +
    Finance::Quote reported a failure for symbol BRK: Not Found
 +
In the former case you can use
 +
    gnucash-cli --verbose --quotes dump fool AAPL
 +
to see all of the fields that Finance::Quote returns. You can also bypass GnuCash and query Finance::Quote directly using <tt>stockdump.pl</tt>. Linux users who've installed Finance::Quote via their package manager can find it in the package info; for example in Debian it's installed at <tt>/usr/share/doc/libfinance-quote-perl/examples/stockdump.pl</tt>. If you installed Finanace::Quote using <tt>gnc-fq-update</tt> it will be in the cpan build directory, often <tt>$HOME/.cpan/build/Finance-Quote-<version>/examples/stockdump.pl</tt>. Windows users will find it in <tt>C:\Strawberry\cpan\build\Finance-Quote-<version>/examples/stockdump.pl</tt>. Use it like <tt>gnucash-cli --quotes</tt>:
 +
    .cpan/build/Finance-Quote-1.58-0/Examples/stockdump.pl fool AAPL
 +
    $VAR1 = {
 +
              'AAPLsuccess' => 1,
 +
              'AAPLsymbol' => 'AAPL',
 +
              'AAPLopen' => '195.18',
 +
              'AAPLmethod' => 'fool',
 +
              'AAPLcurrency_set_by_fq' => 1,
 +
              'AAPLdate' => '12/22/2023',
 +
              'AAPLvolume' => '37149570',
 +
              'AAPLcurrency' => 'USD',
 +
              'AAPLisodate' => '2023-12-22',
 +
              'AAPLclose' => '193.60',
 +
              'AAPLyear_range' => '124.17 - 199.62',
 +
              'AAPLlast' => '193.60',
 +
              'AAPLday_range' => '192.97 - 195.41'
 +
            };
 +
If <tt>stockdump</tt> or <tt>gnucash-cli --verbose --quotes dump</tt> shows all the needed variables but <tt>gnucash-cli --quotes dump</tt> complains then there's a problem with interpreting the Finance::Quote output that you should bring to the attention of the developers. If it doesn't then there's a problem with the Finance::Quote source. You can report that on the [https://github.com/finance-quote/finance-quote/issues|Finance::Quote tracker].
 +
 +
A <tt>Not Found</tt> error means that the source doesn't know about the symbol. That might be because you made a mistake in the symbol, because the source doesn't provide quotes for it, or because it no longer trades. Try searching financial websites for the company name to learn about company news and symbol or market changes.
 +
 +
You can get additional debugging messages from <tt>gnucash-cli</tt> by adding <tt>--log gnc.price-quotes=debug</tt> to the parameters. Passing the same to GnuCash will write the messages to the [[Tracefile|tracefile]].
 +
===== Alphavantage =====
 +
Alphavantage has for several years limited the rate of queries for free accounts to 5 quotes per minute; as of late 2023 the limit is instead 25 quotes per day.
 +
They also require an API key; to get a free one [https://www.alphavantage.co/support/#api-key|register here]. Enter your API key in GnuCash Preferences; to use it with Finance::Quote directly you need to also create an environment variable <tt>ALPHAVANTAGE_API_KEY</tt>.
 +
===== Yahoo JSON =====
 +
Yahoo JSON offers a quotes on a huge range of symbols and is quite fast when it works. Unfortunately the URI has been unstable in 2022 and 2023 causing Finance::Quote to fail from time to time until someone can discover the new one and the Finance::Quote maintainers can update the module and do a new release. There's an ongoing concern that Yahoo's owners will close down the service.
 +
===== Website Scraping =====
 +
Most of the other sources work by scraping the HTML from the source's website. This is brittle because any formatting changes to the web page can break the scraping code. Report failures to the [https://github.com/finance-quote/finance-quote/issues|Finance::Quote tracker].
 +
==== GnuCash 4.x and older ====
 +
===== Broken or outdated Finance::Quote installation =====
  
 
Try the steps below.  After each step, run GnuCash and see if that solution resolved the problem of retrieving stock quotes.
 
Try the steps below.  After each step, run GnuCash and see if that solution resolved the problem of retrieving stock quotes.
  
::;Note for Microsoft Windows users to run perl scripts like <tt>gnc-fq-check</tt>:
+
:;Note for Microsoft Windows users to run perl scripts like <tt>gnc-fq-check</tt>:
::#Open a command line window:
+
:#Open a command line window:
::#:;Windows 10 (not in Tablet Mode): Click in the Cortana <tt>Ask me anything</tt> field to the right of the Start button, begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>. Left-click or tap the <tt>Command Prompt icon</tt>.
+
:#:;Windows 10 (not in Tablet Mode):
::#:;Windows 8 (or Windows 10 in Tablet Mode): From the Start screen, begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>. Left-click or tap the <tt>Command Prompt icon</tt>.
+
:#:# Click in the Cortana <tt>Ask me anything</tt> field to the right of the <code>Start</code> button,
::#:;Windows 7: click <tt>Start</tt> button, type <tt>cmd</tt> in the <tt>Search programs and files</tt> field, press <tt>Enter</tt>
+
:#:# begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>.
::#:;Windows XP: click <tt>Start</tt> button, <tt>All Programs</tt>, <tt>Accessories</tt>, <tt>Command Prompt</tt>
+
:#:# Left-click or tap the <tt>Command Prompt</tt> icon.
::#Change to the drive containing the GnuCash program files (usually C drive) if that is not already the current drive: <SyntaxHighlight lang="bat">C:
+
:#:;Windows 8 (or Windows 10 in Tablet Mode): From the Start screen, begin typing <tt>cmd</tt>, a search menu should appear. The menu should display <tt>Command Prompt</tt>. Left-click or tap the <tt>Command Prompt icon</tt>.
 +
:#:;Windows 7: click <code>Start</code> button, type <tt>cmd</tt> in the <tt>Search programs and files</tt> field, press <tt>Enter</tt>
 +
:#:;Windows XP: click <code>Start</code> button, <tt>All Programs</tt>, <tt>Accessories</tt>, <tt>Command Prompt</tt>
 +
:#Change to the drive containing the GnuCash program files (usually C drive) if that is not already the current drive: <SyntaxHighlight lang="bat">C:
 
</SyntaxHighlight>
 
</SyntaxHighlight>
::#Change to the ...\gnucash\bin directory which contains the required gnc-fq-xxx perl script:
+
:#Change to the <tt>...\gnucash\bin</tt> directory which contains the required gnc-fq-xxx perl script:
::#:; 32 bit version of Windows: <SyntaxHighlight lang="bat">cd \Program Files\gnucash\bin</SyntaxHighlight>
+
:#:; 32 bit version of Windows: <SyntaxHighlight lang="bat">cd \Program Files\gnucash\bin</SyntaxHighlight>
::#:; 64 bit version of Windows: <SyntaxHighlight lang="bat">cd \Program Files (x86)\gnucash\bin</SyntaxHighlight>
+
:#:; 64 bit version of Windows: <SyntaxHighlight lang="bat">cd \Program Files (x86)\gnucash\bin</SyntaxHighlight>
::#Prefix any gnc-fq-xxx perl script command with <tt>perl</tt> and a space: <SyntaxHighlight lang="bat">perl gnc-fq-check</SyntaxHighlight>
+
:#Prefix any gnc-fq-xxx perl script command with <tt>perl</tt> and a space: <SyntaxHighlight lang="bat">perl gnc-fq-check</SyntaxHighlight>
  
:#'''Windows Users:''' Recent versions of Finance::Quote require more recent versions of perl on Windows. If you encounter trouble with the installation, uninstall whichever perl you have, both with ''Start, Settings, Apps'' for recent versions of Windows (or ''Control Panel'' for older versions) and Windows Explorer (delete folder C:\Strawberry), then run <tt>Install Online Price Retrieval</tt>, which will install a recent version of [https://strawberryperl.com/ Strawberry Perl] for you. ''N.B.:'' You don't necessarily want to do that if you're using perl for other purposes, but in that case you probably already know how to upgrade perl.
+
#;Windows only: Recent versions of Finance::Quote require a more '''recent version of perl''' on Windows. If you encounter trouble with the installation, uninstall whichever perl you have, both with ''Start, Settings, Apps'' for recent versions of Windows (or ''Control Panel'' for older versions) and Windows Explorer (delete folder C:\Strawberry), then run <tt>Install Online Price Retrieval</tt>, which will install a recent version of [https://strawberryperl.com/ Strawberry Perl] for you. ''N.B.:'' You don't necessarily want to do that if you're using perl for other purposes, but in that case you probably already know how to upgrade perl.
:#Make sure you're running the '''latest version of Finance::Quote'''. Use [[#Helper_Scripts|gnc-fq-check]] to check what version you are running. Compare this with the latest release at [https://search.cpan.org/search?query=finance%3A%3Aquote&mode=all CPAN] or [{{URL:GH}}finance-quote/finance-quote/releases/ Finance::Quote Releases]. The ''CPAN'' link is a search, and Finance::Quote will be the first hit; the latest version number and release date are under the name. <br>On Windows or {{Mac}} you can update to the latest F::Q release by running the [[#Installing_Finance::Quote_on_Windows|Online Quote Retrieval Installation]] program again or from the Unix command line run [[#Helper_Scripts|gnc-fq-update]]. The providers periodically change interfaces and it's important to keep Finance::Quote up to date to deal with the changes.
+
#Make sure you're running the '''latest version of Finance::Quote'''. Use [[#Helper_Scripts|gnc-fq-check]] to check what version you are running. Compare this with the latest release at [https://search.cpan.org/search?query=finance%3A%3Aquote&mode=all CPAN] or [{{URL:GH}}finance-quote/finance-quote/releases/ Finance::Quote Releases]. The ''CPAN'' link is a search, and Finance::Quote will be the first hit; the latest version number and release date are under the name. <br>On Windows or {{Mac}} you can update to the latest F::Q release by running the [[#Installing_Finance::Quote_on_Windows|Online Quote Retrieval Installation]] program again or from the Unix command line run [[#Helper_Scripts|gnc-fq-update]]. The providers periodically change interfaces and it's important to keep Finance::Quote up to date to deal with the changes.
:#If you are on {{Mac}}, and if the GnuCash GUI app can retrieve quotes but the command line <tt>gnucash-cli</tt> fails with a message, "No quotes retrieved. Finance::Quote isn't installed properly", then check to see if you have multiple Perl installations. If so, <tt>gnucash-cli</tt> may be using a different Perl installation than the GnuCash GUI app uses. See '''[[#Multiple_Perl_installations_on_{{Mac}}|Multiple Perl installations on {{Mac}}]]''' above.
+
#;{{Mac}} only: If the GnuCash GUI app can retrieve quotes but the command line <tt>gnucash-cli</tt> fails with a message, "No quotes retrieved. Finance::Quote isn't installed properly", then check to see if you have multiple Perl installations. If so, <tt>gnucash-cli</tt> may be using a different Perl installation than the GnuCash GUI app uses. See '''[[#Multiple_Perl_installations_on_{{Mac}}|Multiple Perl installations on {{Mac}}]]''' above.
:#Use [[#Helper_Scripts|gnc-fq-dump]] from the command line to check your F::Q sources and stock symbols, and if a currency conversion rate is available between your Default Currency (see Preferences, Accounts) and other currencies used by accounts.
+
#Use [[#Helper_Scripts|gnc-fq-dump]] from the command line to '''check your F::Q sources and commodity symbols''', and if a currency conversion rate is available between your Default Currency (see Preferences, Accounts) and other currencies used by accounts.
:#If the output of the <tt>gnc-fq-dump</tt> command
+
#If the output of the <tt>gnc-fq-dump</tt> command seems ok but Gnucash still fails to get the quote, run from a command line:
:#seems ok but Gnucash still fails to get the quote, run from a command line:
+
#;Linux: <SyntaxHighlight lang="sh">echo '(yahoo_json "CSCO")' | gnc-fq-helper</SyntaxHighlight>
:#:;Linux: <SyntaxHighlight lang="sh">echo '(yahoo_json "CSCO")' | gnc-fq-helper</SyntaxHighlight>
+
#;{{Mac}}: <SyntaxHighlight lang="sh">echo '(yahoo_json "CSCO")' | /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-helper</SyntaxHighlight>
:#:;{{Mac}}: <SyntaxHighlight lang="sh">echo '(yahoo_json "CSCO")' | /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-helper</SyntaxHighlight>
+
#;Windows: <SyntaxHighlight lang="bat">echo (yahoo_json "CSCO") | perl gnc-fq-helper</SyntaxHighlight>
:#:;Windows: <SyntaxHighlight lang="bat">echo (yahoo_json "CSCO") | perl gnc-fq-helper</SyntaxHighlight>
+
#:You should get something that looks like <tt>(("CSCO" (symbol . "CSCO") ..... (currency . "USD")))</tt>. There you can also find bad things like ''trailing blanks''.
:#:You should get something that looks like <tt>(("CSCO" (symbol . "CSCO") ..... (currency . "USD")))</tt>. There you can also find bad things like ''trailing blanks''.
+
#*gives an error message about a missing file instead, that's your problem. This is a dependency that gnucash doesn't know about and so doesn't check for it.  You will need to satisfy the missing dependency.
:#*gives an error message about a missing file instead, that's your problem. This is a dependency that gnucash doesn't know about and so doesn't check for it.  You will need to satisfy the missing dependency.
+
#:But usually, at least under linux, it helps to run <SyntaxHighlight lang="sh">gnc-fq-update</SyntaxHighlight> ''as root''.
:#:But usually, at least under linux, it helps to run <SyntaxHighlight lang="sh"
+
#:For Windows see also [[Windows#Finance::Quote|Windows Finance::Quote]].
>gnc-fq-update</SyntaxHighlight> ''as root''.
+
#Run gnucash from the command line with the <tt>--debug</tt> argument (see [[Tracefile]]), attempt a quote retrieval, and then contact the developers either via email to a User [[Mailing_Lists|Mailing List]] or on IRC.
:#:For Windows see also [[Windows#Finance::Quote|Windows Finance::Quote]].
+
#Sometimes it might help to know what module Perl does actually load.
:#Run gnucash from the command line with the <tt>--debug</tt> argument (see [[Tracefile]]), attempt a quote retrieval, and then contact the developers either via email to a User [[Mailing_Lists|Mailing List]] or on IRC.
+
#:This command will tell you exactly that for e.g. Tiaacref: <SyntaxHighlight lang="sh">perldoc -lm Finance::Quote::Tiaacref</SyntaxHighlight>
:#Sometimes it might help to know what module Perl does actually load.
+
#Check if your '''security software''' (virus scanner) blocks you as in this [{{ListURL}}/pipermail/gnucash-user/2020-September/093106.html user report].
:#:This command will tell you exactly that for e.g. Tiaacref: <SyntaxHighlight lang="sh">perldoc -lm Finance::Quote::Tiaacref</SyntaxHighlight>
+
 
:#Check if your '''security software''' (virus scanner) blocks you as in this [{{ListURL}}/pipermail/gnucash-user/2020-September/093106.html user report].
+
===== Diagnosing Finance::Quote failures =====
 +
 
 +
On files which contain many price quotes from different sources, it is sometimes not obvious which source failed, in particular if a generic error message is thrown, e.g. "There was a system error during retrieving price quotes".
 +
 
 +
To diagnose which requests are issued, start gnucash with additional log output
 +
 
 +
<Syntaxhighlight lang="sh">
 +
gnucash --log gnc.scm=debug
 +
</Syntaxhighlight>
 +
 
 +
and get quotes with "Tools->Price Database->Get Quotes".
 +
 
 +
[[Tracefile|gnucash.trace]] (Linux: <tt>/tmp/gnucash.trace</tt>) contains the relevant log output, e.g.
 +
 
 +
<Syntaxhighlight lang="Console" highlight="2, 4">
 +
* 11:31:01 DEBUG <gnc.scm> ALPHAVANTAGE_API_KEY=XXXXXXXXXXXXXXXXXX
 +
* 11:31:01 DEBUG <gnc.scm> handling-request: (fondsweb LU0804734787 IE00BFNM3G45 DE0009769794 IE00BFNM3P36 FR0010524777 IE00BFNM3D14 DE0008476516 LU1136260384 IE00B3VWMM18 DE0009807008 LU0533033238 GB00B0H6D894 IE00B3RBWM25 LU0823414635 LU0119891520)
 +
* 11:31:06 DEBUG <gnc.scm> results: ((LU0804734787 (symbol . LU0804734787) (gnc:time-no-zone . 2021-11-03 12:00:00) (last . 39303/100) (currency . EUR)) (IE00BFNM3G45 (symbol . IE00BFNM3G45) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 46/5) (currency . USD)) (DE0009769794 (symbol . DE0009769794) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 16107/100) (currency . EUR)) (IE00BFNM3P36 (symbol . IE00BFNM3P36) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 709/100) (currency . USD)) (FR0010524777 (symbol . FR0010524777) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 931/20) (currency . EUR)) (IE00BFNM3D14 (symbol . IE00BFNM3D14) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 181/25) (currency . EUR)) (DE0008476516 (symbol . DE0008476516) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 931/50) (currency . EUR)) (LU1136260384 (symbol . LU1136260384) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 1482/5) (currency . EUR)) (IE00B3VWMM18 (symbol . IE00B3VWMM18) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 14307/50) (currency . EUR)) (DE0009807008 (symbol . DE0009807008) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 1012/25) (currency . EUR)) (LU0533033238 (symbol . LU0533033238) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 21227/50) (currency . EUR)) (GB00B0H6D894 (symbol . GB00B0H6D894) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 763/50) (currency . EUR)) (IE00B3RBWM25 (symbol . IE00B3RBWM25) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 3103/25) (currency . USD)) (LU0823414635 (symbol . LU0823414635) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 69591/50) (currency . EUR)) (LU0119891520 (symbol . LU0119891520) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 36979/50) (currency . EUR)))
 +
* 11:31:06 DEBUG <gnc.scm> handling-request: (alphavantage DAI.DE)
 +
* 11:31:06 DEBUG <gnc.scm> results: #<eof>
 +
</Syntaxhighlight>
 +
 
 +
Here the passing request to fondsweb is listed and the result as well as the failing request to alphavantage. As describe above this can be validated with gnc-fq-helper
 +
 
 +
<Syntaxhighlight lang="Console">
 +
$ echo '(alphavantage "DAI.DE")'|gnc-fq-helper
 +
Can't use an undefined value as a HASH reference at /usr/share/perl5/Finance/Quote/AlphaVantage.pm line 228.
 +
$ echo '(yahoo_json "DAI.DE")'|gnc-fq-helper
 +
(("DAI.DE" (symbol . "DAI.DE") (gnc:time-no-zone . "2021-11-05 12:00:00") (last . #e87.59) (currency . "EUR")))
 +
$
 +
</Syntaxhighlight>
  
 
== Documentation ==
 
== Documentation ==
* [{{BuildURL}}/docs/C/gnucash-help/acct-create.html#Online-price-setup Development Snapshot]
+
* [{{URL:docs:manual}}/acct-create.html#Online-price-setup Development Snapshot]
* [{{WebURL}}/docs/v{{MainVersion}}/C/gnucash-help/acct-create.html#Online-price-setup {{Version}} Help]
+
* [{{URL:docs:manual}}/acct-create.html#Online-price-setup {{Version}} Help]
 
=== Standards ===
 
=== Standards ===
 
* full ISO 10383 list of [https://www.iso20022.org/market-identifier-codes market-identifier-codes]
 
* full ISO 10383 list of [https://www.iso20022.org/market-identifier-codes market-identifier-codes]
 +
=== Notes ===
 +
<references />
 
----
 
----
 
[[Using GnuCash | Back to: Using GnuCash]]
 
[[Using GnuCash | Back to: Using GnuCash]]

Latest revision as of 12:28, 22 October 2024

Languages: Deutsch 简体中文
Back to: Using GnuCash

GnuCash can automatically retrieve the current currency exchange rates and share price of marketable commodities (such as stocks and mutual funds) - often simply called "quotes" - so that you do not need to manually enter and update them in the GnuCash Price Database one at a time. If you are tracking the prices of more than a handful of securities, this features saves an enormous amount of time.

Before you continue read the Official Documentation:

Manual
Setting Up the Quote Retrieval,
Steps to enable Online Quotes updating per account;

We try to reduce redundancy.

Contents

Overview

GnuCash stores the share prices of investments in the respective buy/sell/split transactions, currency exchange rates and additional quotes in an internal price database. Although it is possible to enter prices manually into the price database, it is more convenient to update them from online sources. GnuCash uses an external program written in the Perl programming language called Finance::Quote (often shortened to simply F::Q) to fetch these quotes online. Therefore, for this feature of GnuCash to work, your computer will need to have some additional software installed beyond simply the GnuCash application itself, as well as have an active Internet connection.

F::Q uses source AlphaVantage for all currency exchange rates.

About Finance::Quote

The Finance::Quote Perl module is

managed at GitHub and
has a SourceForge website.

Most linux distributions have packages for recent versions in their own repositories (e.g., dnf install perl-Finance-Quote). In addition for all platforms downloads are available

like for other Perl modules at CPAN (both recent),
and additionally at SourceForge project.

You can report issues

at their bugtracker
or if unsure discuss them on their devel-mailing list at SF.
https://rt.cpan.org/Public/Dist/Display.html?Status=Active&Name=Finance-Quote was the old tracker.

However, please be reasonably confident that the problem truly lies in the Finance::Quote software and not somewhere else (e.g., could your Internet connection simply be down right now?) before you submit a bug report to the Finance::Quote developers.

The Finance::Quote software gathers its price data from several Web sites around the world that provide this information in different ways. Some sources offer

  • an API like JSON or YQL[1],
  • downloads, usually as CSV file, and finally,
  • quite literally by extracting information from the web page itself.

As these sources change frequently, we advise you to keep Finance::Quote up-to-date.

Setting up online quotes in GnuCash

The GnuCash Guide includes instructions on setting up online quotes. This set up procedure provides the input to Finance::Quote, so it must be completed before the "Get Quotes" button in GnuCash's Price Database will have any effect.

Below are some extra caveats to keep in mind:

Note
The examples below use the command line syntax for GnuCash 5.0 and up. Users of older GnuCash versions can uuse the gnc-fq-dump helper script instead. More on this in #Obsolete scripts.
  1. The symbol depends on the source:
    $ gnucash-cli --quotes dump currency USD EUR
    1 EUR = 1.1004732 USD
    $ gnucash-cli -V --quotes dump yahoo_json USD
    USD:
            high => 25.7606
            open => 25.2
           close => 24.88
            last => 25.7606
      year_range =>        11.65 - 29.65
             low => 24.99
         isodate => 2023-05-05
            date => 05/05/2023
            name => USD (ProShares Ultra Semiconductors)
         success => 1
       div_yield => 0
        exchange => Sourced from Yahoo Finance (as JSON)
          method => yahoo_json
          symbol => USD
        currency => USD
            type => ETF
          volume => 20348
              pe => null
             eps => null
    
    Ultra SemiconductorsUS Dollar
  2. Some special characters like & get interpreted by your command shell. For example using "M&M.NS" unquoted would fetch the quote for "M" instead and treat "M.NS" as a separate shell command.
    $ gnucash-cli -V --quotes dump yahoo_json M&M.NS
    [1] 1732
    If 'M.NS' is not a typo you can use command-not-found to lookup the package that contains it, like this:
        cnf M.NS
    M:
          method => yahoo_json
         isodate => 2023-05-05
            last => 15.12
          volume => 3446273
          symbol => M
            type => EQUITY
            open => 15
            date => 05/05/2023
            high => 15.2873
      year_range =>        14.48 - 25.12
           close => 14.75
              pe => 3.7425742
        currency => USD
         success => 1
             eps => 4.04
       div_yield => 4.2711865
             low => 14.92
        exchange => Sourced from Yahoo Finance (as JSON)
            name => M (Macy's Inc)
    
    Escaping by backslash correctly returns the result for M&M.NS (this was not working with gnc-fq-dump in prior versions!)
    $ gnucash-cli -V --quotes dump yahoo_json M\&M.NS
    M&M.NS:
             eps => null
              pe => null
             low => 1208.05
        exchange => Sourced from Yahoo Finance (as JSON)
        currency => INR
          volume => 4753303
            last => 1211.2
            high => 1242.35
          symbol => M&M.NS
            type => EQUITY
            open => 1232.8
            name => M&M.NS (MAHINDRA &MAHINDRA)
      year_range =>        853.7 - 1397
       div_yield => 0
          method => yahoo_json
            date => 05/05/2023
         success => 1
         isodate => 2023-05-05
           close => 1231.7
    
    Percent-encoding also gets the right result, though it returns slightly less readable data (and this was the only option that worked with gnc-fq-dump in prior versions)
    $ gnucash-cli -V --quotes dump yahoo_json 'M%26M.NS'
    M%26M.NS:
             eps => null
       div_yield => 0
        currency => INR
            name => M%26M.NS (MAHINDRA &MAHINDRA)
             low => 1208.05
              pe => null
         isodate => 2023-05-05
            open => 1232.8
        exchange => Sourced from Yahoo Finance (as JSON)
            last => 1211.2
          method => yahoo_json
          volume => 4753303
      year_range =>        853.7 - 1397
            date => 05/05/2023
         success => 1
            type => EQUITY
           close => 1231.7
          symbol => M%26M.NS
            high => 1242.35
    

Command line interface

GnuCash also offers a command line tool called "gnucash-cli" that can interact directly with Finance::Quote.

Note
Prior to gnucash 5.0 this command line tool was pretty limited with regards to quotes. It could only update quotes in an existing book. For more interaction these releases shipped a few helper scripts. These are documented in #Obsolete scripts.

How the command is accessed depends on the operating system; the following examples assume that you're running a unix-like system and that gnucash-cli is in a directory included in the PATH environment variable. If you're on a unix-like system and gnucash-cli isn't accessible via the path, prefix it with its path, e.g. /opt/gnucash/bin/gnucash-cli. For other operating systems or Flatpak:

Flatpak:
   flatpak ---command gnucash-cli org.gnucash.Gnucash <args>
macOS Gnucash.app bundle:
   /Applications/Gnucash.app/Contents/macOS/gnucash-cli <args>
Microsoft Windows:
   "C:\Program Files (x86)\gnucash\bin\gnucash-cli.exe" <args>

In all cases replace <args> with whatever comes after gnucash-cli in the examples below.

gnucash-cli has the following quotes related subcommands:

gnucash-cli --quotes get <book>

This command opens datafile <book> and attempts to retrieve the most recent price for each quote in it via Finance::Quote. This command was actually introduced already in gnucash 4.0. In older versions still the gnucash application itself had the option --add-price-quotes to the same effect. This option has now been removed from gnucash 5.0 in favour of the gnucash-cli command instead.

Note
GnuCash 5.0 had a bug in this command, which has been fixed in GnuCash 5.1. To make it work with GnuCash 5.0 you need to add an extra double-dash between get and <book> like so:
$ gnucash-cli --quotes get -- <book>
There is a space between '--' and <book> here!

gnucash-cli --quotes info

This command outputs the version number of the Finance::Quote module currently installed as well as a list of sources it can query.
$ gnucash-cli --quotes info
Found Finance::Quote version 1.54.
Finance::Quote sources:
aex          alphavantage              amfiindia    asegr        asx          
aufunds      australia    bamosz       bet          bloomberg    bourso       
bse          bseindia     canada       canadamutual              comdirect    
cse          deka         dutch        dwsfunds     europe       
fetch_live_currencies     fidelity     fidelity_direct           
finanzpartner             fondsweb     fool         france       ftfunds      
fundata      fundlibrary  goldmoney    greece       hu           hufund       
hungary      hustock      iexcloud     india        indiamutual  
known_currencies          morningstarau             morningstarch             
morningstarjp             mstaruk      nasdaq       nseindia     nyse         
nzx          onvista      oslobors     romania      seb_funds    sinvestor    
six          tesouro_direto            tiaacref     tmx          tradegate    
tradeville   treasurydirect            troweprice   troweprice_direct         
tsp          tsx          ukfunds      unionfunds   usa          xetra        
yahoo_json   za

You can find more details about the sources in the GnuCash Manual:

Work in Progress
Recent Released
Should there be any issue with your Finance::Quote installation it will return an error message with a possible fix.
$ gnucash-cli --quotes info
Failed to initialize Finance::Quote: Can't locate JSON.pm in @INC (you may need to install the JSON module) (@INC contains: /usr/local/lib64/perl5/5.36 /usr/local/share/perl5/5.36 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /home/janssege/Development/gnucash/stable/build/bin/finance-quote-wrapper line 277.
BEGIN failed--compilation aborted at /home/janssege/Development/gnucash/stable/build/bin/finance-quote-wrapper line 277.
Note
The most recent Finance::Quote version is 1.64.

gnucash-cli --quotes dump

This command returns quote data for a source and a list of symbols in a format which is easy to read for humans. It is useful for checking that a given online quote source is online and functional.

To get a stock price, run a command from the command line of the form:
gnucash-cli -V --quotes dump $SOURCE $SYMBOL
# e.g.
gnucash-cli -V --quotes dump alphavantage IBM
Note
The -V parameter is optional. If omitted only the tags relevant to use within gnucash will be printed:
$ gnucash-cli --quotes dump alphavantage IBM
Finance::Quote fields GnuCash uses:
    symbol: IBM             <=== required
      date: 05/04/2023      <=== recommended
  currency: USD             <=== required
      last: 122.5700        <=\ 
       nav:                 <=== one of these
     price:                 <=/
If the command is run with the -V parameter, all tags retrieved from Finance::Quote are printed:
$ gnucash-cli -V --quotes dump alphavantage IBM 2>/dev/null
IBM:
         net => -0.8800
        date => 05/04/2023
      volume => 4468237
     isodate => 2023-05-04
        high => 123.5200
    currency => USD
      symbol => IBM
    p_change => -0.7128
      method => alphavantage
     success => 1
       close => 123.4500
        open => 123.0300
currency_set_by_fq => 1
         low => 121.7563
        last => 122.5700
Since Finance::Quote 1.41 the default source for currencies is hardcoded to be Alpha Vantage, e.g.
gnucash-cli  --quotes dump currency USD EUR
But it is still possible to get the rate between 2 currencies AAA and BBB using source Yahoo as JSON:
gnucash-cli --quotes dump yahoo_json ${AAA}${BBB}=X
# e.g.
gnucash-cli -V --quotes dump yahoo_json USDEUR=X

Helper Scripts

Note
All helper scripts mentioned in this section are Perl scripts. Before you can use them you must have a functioning Perl installation on your system.

gnc-fq-update

As stated earlier, Finance::Quote is external to GnuCash and hence managed independently of GnuCash. Linux distributions typically make it easy: you can usually download Finance::Quote from their package repositories. For macOS and Windows a different approach is needed.

To help with installing and updating on these platforms, GnuCash comes with a helper script called gnc-fq-update which installs or updates the Finance::Quote software module along with its dependencies.

Notes
  • This program needs superuser or administrative privileges to succeed in Linux or macOS but not in Windows 10.
  • If you want to use this script on Linux to install a more recent Finance::Quote module than is shipped by your distribution, you may want to uninstall the system package first to avoid any conflicts.
  • Technically it is a Perl script which calls CPAN.

Note for Microsoft Windows users to run Perl scripts like gnc-fq-update

Unixoid operating systems use a shebang (#!) to associate Perl scripts with the Perl interpreter. Windows, on the other hand, makes no such association. Attempting to execute Perl scripts by directly calling them will fail, as shown below.

C:\> gnc-fq-check
gnc-fq-check is not recognized as an internal or external command, operable program or batch file

In order to run Perl scripts on Windows, use the following:

  1. Open a command line window:
    Windows 10 (not in Tablet Mode)
    Click in the Cortana Ask me anything field to the right of Start Button, begin typing cmd, a search menu should appear. The menu should display Command Prompt. Left-click or tap the Command Prompt icon.
    Windows 8 (or Windows 10 in Tablet Mode)
    From the Start screen, begin typing cmd, a search menu should appear. The menu should display Command Prompt. Left-click or tap the Command Prompt icon.
    Windows 7
    Click Start Button → type cmd in the Search programs and files field, press Enter
    Windows XP
    Click Start Button → All ProgramsAccessoriesCommand Prompt
  2. Change to the drive containing the GnuCash program files (usually C drive) if that is not already the current drive:
    C:
    
  3. Change to the ...\gnucash\bin directory which contains the required gnc-fq-xxx Perl scripts:
    32 bit version of Windows
    cd \Program Files\gnucash\bin
    
    64 bit version of Windows
    cd \Program Files (x86)\gnucash\bin
    
  4. Prefix any gnc-fq-xxx Perl script command with Perl and a space:
    perl gnc-fq-check
    

Obsolete scripts

GnuCash 5.0 introduces several extra command line options in gnucash-cli to interface with Finance::Quote. These are explained in #Command line interface. Prior to that release, GnuCash provided a few extra helper scripts to achieve the same. While no longer available for GnuCash 5.0 and later, they are still mentioned here for historical interest.

gnc-fq-check

Replaced by
#gnucash-cli --quotes info

This program returns the version number of Finance::Quote module currently installed as well as a list of sources available via the Finance::Quote module. It will also inform you if there is a problem with your Finance::Quote installation or if it is missing, and may suggest a fix.

Example with broken dependency
$ gnc-fq-check 
Can't locate Mozilla/CA.pm in @INC (you may need to install the Mozilla::CA module) (@INC contains: /usr/lib/perl5/site_perl/5.30.1/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.30.1 /usr/lib/perl5/vendor_perl/5.30.1/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.30.1 /usr/lib/perl5/5.30.1/x86_64-linux-thread-multi /usr/lib/perl5/5.30.1 /usr/lib/perl5/site_perl) at /usr/lib/perl5/vendor_perl/5.30.1/Finance/Quote/Tiaacref.pm line 33.
Compilation failed in require at (eval 303) line 1.
BEGIN failed--compilation aborted at (eval 303) line 1.
 at /usr/local/bin/gnc-fq-check line 91.
("1.47" "adig" "aex" "aiahk" "alphavantage" "amfiindia" "asegr" "asia" "asx" "australia" "bamosz" "bet" "bmonesbittburns" "bourso" "brasil" "bse" "bsero" "canada" "canadamutual" "citywire" "cominvest" "cse" "deka" "dutch" "dwsfunds" "europe" "fetch_live_currencies" "fidelity" "fidelity_direct" "fidelityfixed" "financecanada" "finanzpartner" "finland" "fool" "france" "ftfunds" "ftportfolios" "ftportfolios_direct" "fundlibrary" "goldmoney" "greece" "hex" "hu" "hufund" "hungary" "hustock" "indiamutual" "known_currencies" "lerevenu" "maninv" "morningstar" "morningstarjp" "mstaruk" "nasdaq" "nyse" "nz" "nzx" "platinum" "romania" "seb_funds" "sixfunds" "sixshares" "stockhousecanada_fund" "tdefunds" "tdwaterhouse" "tiaacref" "tnetuk" "troweprice" "troweprice_direct" "trustnet" "tsp" "tsx" "uk_unit_trusts" "ukfunds" "unionfunds" "usa" "usfedbonds" "vanguard" "vwd" "yahoo" "yahoo_asia" "yahoo_australia" "yahoo_brasil" "yahoo_europe" "yahoo_json" "yahoo_nz" "yahoo_yql" "za" "za_unittrusts")
The first part is the error message about a missing Mozilla/CA.pm.
At the end in parentheses is the normal output of the currently installed Finance::Quote version and a list of available sources.
Note: The most recent Finance::Quote version is 1.64.
If an error is displayed, see the next section gnc-fq-update. Otherwise, continue with gnc-fq-dump.

gnc-fq-dump

Replaced by
#gnucash-cli --quotes dump

This program returns quote data for a source and a list of symbols in a format which is easy to read for humans. It is useful for checking that a given online quote source is online and functional.

To get a stock price, run a command from the command line of the form:
gnc-fq-dump -v $SOURCE $SYMBOL
# e.g.
gnc-fq-dump -v alphavantage IBM
Since Finance::Quote 1.41 the default source for currencies is hardcoded to be Alpha Vantage, e.g.
gnc-fq-dump currency USD EUR
But it is still possible to get the rate between 2 currencies AAA and BBB using source Yahoo as JSON:
gnc-fq-dump -v yahoo_json ${AAA}${BBB}=X
# e.g.
gnc-fq-dump -v yahoo_json USDEUR=X
To test that Finance::Quote is working for currencies within GnuCash,
  1. find a two-currency transaction and
  2. right-click on it, then
  3. select Edit Exchange Rate in the context menu.
The transfer dialog will appear. Click the Fetch Rate button and if everything is behaving itself the current rate will fill in the exchange rate box.

gnc-fq-helper

This script is the interface between GnuCash and Finance::Quote and primarily intended to be used by GnuCash internally. It does more or less what gnc-fq-dump does, but in a form which the program understands. Input and output are Scheme expressions.

Requirements

This section describes the software installation required for GnuCash's online quote feature to work. Briefly, in addition to the GnuCash application itself, you will need to install Perl and its Finance::Quote module.

Perl

The Finance::Quote module relies on Perl, so Perl must be installed first. The procedure for installing Perl is handled differently on different operating systems.

Installing Perl on Unix

On most Unix-like operating systems (Linux, AIX, *BSD, HPUX, Solaris, etc.), Perl is probably already installed. If it is not, but your Unix-like operating system has a package manager, it will likely be installed automatically as a dependency of Finance::Quote.

To check if Perl is installed, invoke the perl -v command at a terminal prompt to get the Perl interpreter's version number. If that fails, the best bet is to use your package manager to install it. Refer to your operating system's documentation for additional details on using your package manager.

The GnuCash Flatpak has a working perl and Finance::Quote already installed. You will need to add your Alpha Vantage API key if you require currency conversion rates or to use Alpha Vantage as a price source. If you need to get currency conversion rates, you need Finance::Quote version 1.53 or later which was first included in the GnuCash 4.12-1 Flatpak. If you need a more recent version of F::Q than is included in the latest GnuCash Flatpak, you should wait until the GnuCash developers incorporate the version you need in the GnuCash Flatpak as it is not easy to update F::Q in the Flatpak because it doesn't contain the tools CPAN needs.

Installing Perl on macOS

On Apple's macOS computers, Perl is already installed by default. To confirm this, open the Terminal application (usually located in the Utilities folder of your Applications folder), and invoke the
/usr/bin/perl -v
command to see the Perl interpreter's version number.

Installing Perl on Windows

The way to do this is slightly different depending on the version of GnuCash.

GnuCash 2.5 and more recent

Everything is done for you by running the "Install Online Price Retrieval" command. You can find this in the Windows start menu under the GnuCash group. This will install Strawberry perl and all the perl modules required to run Finance::Quote.

  • With typical Windows 10 security, you need Administrator privileges to install perl.
After you initiate "Install Online Price Retrieval", a User Access Control window will appear
if you are an Administrator
to confirm you intend to install software , or
else
to enable you to enter the credentials of an administrative user.
  • Installation can take from 15 minutes to several hours or more depending on the speed of your PC and internet connection.

No such file or directory or permission denied errors while installing Strawberry perl:

Turning of anti-virus software while installing perl may help.
This issue was reported to McAfee as Service Request number 1446848354 16 Mar 2014.
GnuCash 2.4 and before

These GnuCash releases only work with ActivePerl, which you first have to install manually.

  • If you are upgrading from an earlier version of ActivePerl, uninstall the old version and delete its directory before installing the new one.
  • Download and install it from ActiveState. ActivePerl versions before 5.16.3 may not deliver the latest version of F::Q (1.18 as of this writing). The 32-bit version is recommended, even on 64-bit Windows, but success has also been achieved running the 64 bit version under Windows XP Pro x64 SP2 with both GC 2.4.11 and 2.4.12(YMMV). If prompted, you don't have to provide contact details, just choose the MSI installer for your system. It is strongly recommended to use the default installation directory.
  • Once perl is installed, use the start menu item "Install Online Price Retrieval" from the GnuCash group to install the necessary Perl modules for F::Q and verify the setup.

Because ActivePerl uses their own precompiled perl package manager (PPM) you should - in the case you need to update F::Q - not use the Comprehensive Perl Archive Network (CPAN). Instead you can use the PPM Index: Finance-Quote to see the state and download the latest ppmx they compiled successful.

GnuCash 2.2.6 and before

Installation is similar to the installation for GnuCash 2.4, except that these releases only work with ActivePerl 5.8 and the menu item is called "Install Finance-Quote".

You are advised to upgrade to a more recent version of GnuCash though, because it's unlikely you can get Finance::Quote to work still on these old releases. You will have a hard time finding a version of ActivePerl 5.8 (unless you pay ActiveState for it), and the version of Finance::Quote that comes with this perl version is outdated.

Source: perl.org

Finance::Quote

As mentioned previously, Finance::Quote is a Perl module that must be installed to enable online quote fetching. Finance::Quote, in turn, depends on a number of other Perl modules.

You can check to see if your system has Finance::Quote installed by running the gnc-fq-check helper program after you have installed Perl itself. Alternatively, you can open the "About GnuCash" window (from the menu, choose Help → About, or on macOS, from the menu choose GnuCash → About GnuCash) and look for a line reading Finance::Quote: 1.64 or similar; this screen reports the currently installed version of Finance::Quote (1.64 in the example given), if it can find one. If GnuCash cannot find a Finance::Quote version, this line will read Finance::Quote: -.

The easiest way to install the Finance::Quote software needed for retrieving online price quotes is to use the provided installation tools, or your system's package manager. Both the Windows and macOS GnuCash packages include provided update tools for Finance::Quote, while many Linux distributions provide a standard way to install packages (e.g., the apt program on Debian-based Linux distributions and the dnf tool on RedHat-based Linux distrubtions such as Fedora). These methods are described next.

Installing Finance::Quote on Windows

On a Windows computer, GnuCash provides the Install Online Price Retrieval program, which is located in the GnuCash group in the Start Menu.

  • If your computer is in Tablet Mode you must switch to Desktop Mode to see the entry. Or just run
    C:\Program Files (x86)\gnucash\bin\install-fq-mods.cmd
    

Simply click on it to begin the Finance::Quote installation process. You can re-run the Install Online Price Retrieval program as often as you like to ensure the Finance::Quote module remains up to date.

Installing Finance::Quote on macOS

Until GnuCash 3.6, GnuCash provided the FinanceQuote Update app, which was located in the disk image (.dmg file) along with the main GnuCash app itself. When you installed GnuCash by dragging and dropping the GnuCash app icon to a location on your computer's hard drive (like your Applications folder), you could also consider installing the FinanceQuote Update app into the same folder as you installed the main GnuCash app.

Launch the FinanceQuote Update app by double-clicking it to begin the Finance::Quote installation process. You can re-run the FinanceQuote Update app program as often as you like to ensure the Finance::Quote module remains up to date.

Installing Finance::Quote on macOS from a Terminal prompt

New security requirements for macOS 10.14.6 and 10.15.0 put an end to the FinanceQuote Update app. Users must now use Terminal.app to install Finance Quote.

sudo /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update

The first time you run gnc-fq-update or cpan cpan will display some questions:

Loading internal logger. Log::Log4perl recommended for better logging

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes]

Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib] sudo

Unless you're a perl expert and know differently, you should accept the default yes on the first question and select sudo on the second. That will invoke sudo for every install step, and so will sometimes stop and request your password to authenticate sudo.

Compiled binaries on Apple Silicon (aka M1, M2, etc.) processors can be native or Intel. The latter run under a special program called Rosetta2 and GnuCash may be one such program if you're using an x86_64 build. (Apple Silicon builds are available since GnuCash 5.8). The Perl binaries that Apple supplies are multi-architecture ("universal" in Apple-speak) but left to itself cpan will install only native binaries resulting in GnuCash not being able to use them. You can tell cpan to install Finance::Quote for Intel with

    arch -x86_64 /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update

but that has risks: If cpan decides to update itself or if you use cpan for other purposes you can wind up with a mix of Apple Silicon and Intel binaries that can break your perl installation. It's better to set the environment variable ARCHFLAGS='-arch arm64 -arch arm64e -arch x86_64' to get cpan to always make universal binaries. To do that for Finance::Quote only you can run

    ARCHFLAGS='-arch arm64 -arch arm64e -arch x86_64' /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update

but if you use perl for other things you might prefer to set ARCHFLAGS in you shell profile so that cpan always builds universal binaries.

If you've already run cpan or gnc-fq-update without having set ARCHFLAGS you may need to clean /Library/Perl/<perl-version>. There may be several versions in /Library/Perl especially if you've upgraded your macOS from previous versions instead of having a clean install or used the Migration Assistant to load a new Mac from an old one. The only one that matters is the one corresponding to the current version of /usr/bin/perl. To check that run

/usr/bin/perl --version

You can ignore any micro version numbers. A safe way to clean e.g. /Library/Perl/5.30 is

sudo mv /Library/Perl/5.30 /Library/Perl/saved-5.30
sudo mkdir /Library/Perl/5.30
sudo cp /Library/Perl/saved-5.30/AppendToPath /Library/Perl/5.30/

Once you've completed reinstalling all of your extra perl modules you can compare 5.30 and saved-5.30 to make sure you didn't miss anything. Once you're satisfied you can safely delete /Library/Perl/saved-5.30.

Note the last line in that procedure: /Library/Perl/5.xx/AppendToPath contains a single line, /System/Library/Perl/5.xx/Extras. If the file is missing or is missing that line then a lot of perl infrastructure is missing too and installing Finance::Quote will either take a long time while cpan installs all of those modules; it may fail altogether because certain C libraries or their headers (notably OpenSSL) aren't installed where cpan can find them. A normal installation of Finance::Quote will include only a few modules and provided you have a reasonable fast internet connection will take only 2-3 minutes. If it's taking longer check that AppendToTargets is installed and contains the right path. You can double-check it by printing the include-path variable @INC. Run either

perl -V | tail

or

perl -e 'print(join("\n", @INC), "\n");'

and check for /System/Library/Perl/Extras/5.xx and /System/Library/Perl/Extras/5.xx/darwin-thread-multi-2level are at the end of the list. If they're not clear </Library/Perl/5.xx</code using the procedure above and fix AppendToPath.

Note
macOS will not allow you to use cat to create or modify AppendToPath but you can use any plain text editor including TextEdit or nano.

Credit for the environment variable belongs to this Stack Overflow answer and it also provides more background. The procedure to clear out cpan-installed modules is from Bug 798928 comment 11.

The gnc-fq-update script always runs the macOS system Perl runtime (/usr/bin/perl), and disregards the Perl installed by package managers. Doing so ensures GnuCash, when launched from Finder, can locate Finance::Quote correctly.

Installing Finance::Quote on Linux

On a Linux computer, the recommended way to install Finance::Quote is by searching in your OS distribution's package manager for finance-quote. Note that your distribution's package maintainer may prefix or suffix the package name with perl, lib, or both. For example, in Ubuntu 18.04 and later, the package is called libfinance-quote-perl. We also recommend that you check the version of Finance::Quote offered by your OS package repositories to ensure it is a recent-enough version.

If no recent version of the Finance::Quote module is offered by your package manager, you should run the gnc-fq-update helper script manually. As root (using the su and/or the sudo commands) run the GnuCash Finance Quote update script:
gnc-fq-update

This will begin the installation procedure for Finance::Quote and all of its dependencies.

Note for (Ubuntu based) distributions
Some of them removed it from the package. In this case you can
  1. download it from github e.g. into your personal ~/bin directory,
  2. Execute
    $ which perl
    /usr/bin/perl
    
    to get the proper path to your perl executable,
  3. In the first line replace @-PERL-@ with that path—here /usr/bin/perl
    remove the trailing .in from its name and
    mark the file as executable.
A discussion of how to fix it in Ubuntu can be found at gnucash-user/2012-September.

Since GnuCash version 2.6.12, this helper script uses CPAN (see the next section) to install the following Perl modules:

  • Date::Manip
  • Finance::Quote
  • and their dependencies

Installing Finance::Quote using CPAN

CPAN is

  1. the Comprehensive Perl Archive Network, which provides a collection of free Perl software (called modules),
  2. a program with which you can obtain the perl Finance::Quote module along with all of its dependencies from there.

If the methods listed above for your specific Operating System or distribution fail, you may nevertheless be able to install Finance::Quote by directly interfacing with CPAN yourself.

To do so using CPAN:

sudo perl -MCPAN -e shell
# Either, if F::Q is missing, install it with
  install Finance::Quote
# or, if F::Q is outdated, update it with
  upgrade Finance::Quote
# finally check for Date::Manip
  install Date::Manip
# and exit:
  q

On the first run of cpan it needs some configuration:

$ cpan
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
 
Would you like to configure as much as possible automatically? [yes]

It is usually safe to accept the defaults.

Sources
FAQ#Q: How do I install Finance::Quote on a Mac?
Windows#Finance::Quote
FAQ#Q: How do I fix a "system error" or "unknown error" when getting stock quotes?

Finding the right Source and Symbol

Not all sources offer all commodities and different sources use different symbols. Common symbols are:

  • Ticker symbols: 1-4 character abbreviation of company names, often used for US shares;
  • National Security Identification Numbers (NSIN): like CUSIP, often used by national fund companies;
  • ISIN: International Security Identification Numbers, at least in the EU they are more and more replacing the different NSINs;
  • sometimes completed by an appendix indicating the market place.

If your commodity is a mutual fund and F::Q offers its fund's company as a source (deka, dws, ...) look for the symbol on the mutual fund's website.

If there is a source for its registered exchange (AEX, ASX, ...) do the same.

In other cases google the ISIN to get a list of possible sources.

Global players: Alpha Vantage and Yahoo* are stronger in shares and Morningstar* in funds.

A fast way to check you have the correct source and symbol is to use gnucash-cli --quote dump. Run from a commandline
gnucash-cli -V --quote dump <Source> <Symbol>

Source Alphavantage, US

This source was introduced with Finance::Quote version 1.41.

Finance::Quote's alphavantage and currency sources require since then an AlphaVantage API key that you can get free from the AlphaVantage Website. You can set this key in the GnuCash preferences and it will then be used by GnuCash as well as gnucash-cli.

Note
For the obsolete command line scripts like gnc-fq-dump you will need to set an environment variable ALPHAVANTAGE_API_KEY.
Currency Problem in 2022
GnuCash temporarily stopped being able to retrieve currency exchange rates using a free AlphaVantage API key from about Aug 15 2022 because AlphaVantage made the method F::Q used to obtain exchange rates unavailable for free API keys.
F::Q has been modified to work with AlphaVantage free API keys and this is available in F::Q version 1.53 which was released on CPAN Oct 12 2022. Unfortunately in F::Q 1.53, which uses the FX_DAILY API, currency quotes are not available for Crypto and Precious Metals.
F::Q 1.53 has been updated into the GnuCash 4.12-1 Linux Flatpak.
See Bug 798599.
Around Oct 9 2022 AlphaVantage removed the recent requirement that the CURRENCY_EXCHANGE_RATE API require a Premium API Key, so F::Q has reverted the changes in Pull 230 to use FX_DAILY instead of CURRENCY_EXCHANGE_RATE for currency quotes. This is in F::Q 1.54 which was released Dec 27 2022. F::Q 1.54 has not yet been updated into the latest Linux Flatpak.

Some sources are multiple sources. Multiple sources will be tried, until a price is obtained. If you use a multiple source that includes alphavantage, then you should use an AlphaVantage API key. See A.1.3. Finance::Quote Sources - Multiple sources

To use the API key

in Gnucash—the program
it can be entered in:
GnuCash versions since 2.6.20/2.7.4
(in the Program) Edit->Preferences tab Online Quotes;
GnuCash up to 2.6.19/2.7.3
It has to be set in the environment.local file:
  1. Quit GnuCash if it's running;
  2. you'll need administrator privileges in most cases, see the docs of your OS;
  3. use any text editor (Windows users should prefer Notepad to WordPad or Word)and add
    ALPHAVANTAGE_API_KEY=##############
    
    to the environment.local file, substituting your key for "#############".
in the Helper Scripts gnc-fq-dump and gnc-fq-helper
To use Alpha Vantage sources outside of GnuCash, it is necessary to put the ALPHAVANTAGE_API_KEY into your command line's environment like
Linux or macOS
ALPHAVANTAGE_API_KEY=############## gnc-fq-dump alphavantage CSCO
or
export ALPHAVANTAGE_API_KEY=##############
gnc-fq-dump alphavantage CSCO
Windows
cd \Program Files (x86)\gnucash\bin
set ALPHAVANTAGE_API_KEY=##############
gnc-fq-dump alphavantage CSCO
Tip
To have the key available in every session you can also add it to your OS's environment or your command shell configuration. See your OS's manual.

Alpha Vantage has limited the number of stock and currency quotes that may be requested in a given period using their free API key. If this limit is exceeded, GnuCash will show "unknown error". Finance::Quote v#1.48 and later copes with this for stock quotes, and v1.49 copes with this for currency quotes, although v1.50 (yet to be released as at Jun 14 2020) copes better. Paid Premium Alpha Vantage subscriptions do not have this limit.

Searching for a Symbol

You can search for a symbol by entering the following in a web browser (e.g. Chrome or Firefox) address field

https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=Search Key Words&apikey=#############
e.g.
https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=International Business Machines&apikey=#############

Substitute your API key for "#############". Using a space to separate keywords works in Chrome and Firefox but some web browsers may need %20 instead of each space. E.g.

https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=International%20Business%20Machines&apikey=#############

Notes on Specific Exchanges

Australian Stock Exchange
Quotes may be obtained by using source Australian Stock Exchange or Yahoo as JSON. These are asx and yahoo_json respectively in gnc-fq-dump.
Getting quotes from Alpha Vantage for stocks listed on the ASX in currency AUD using a .AX suffix on the stock symbol (e.g. CBA.AX) stopped working sometime between 18 Mar 2018 and 30 May 2020.
London Stock Exchange'
It has been reported on GnuCash User Email List that LSE stocks that previously Alpha Vantage was able to provide quotes for (e.g. BP.L), stopped working on 25 Jun 2020.

Source Yahoo

On 1 November 2017 Yahoo! discontinued its csv interface, which had been the primary source that Finance::Quote used for all currency quotes and the following stock quotes:

yahoo* (with exception of json and yql[1]), canada, usa, nyse, nasdaq, vanguard.

The Finance::Quote maintainers have set up a new source, Alpha Vantage, to replace most of the discontinued Yahoo sources.

To update yahoo sources that no longer work, use the Security Editor in GnuCash to edit every security with Get Online Quotes enabled that uses a discontinued Yahoo! source and either

  • disable (uncheck) Get Online Quotes or
  • change the source to "Yahoo as JSON", "Yahoo as YQL"[1] or
    GnuCash 2.6.20/2.7.7 and newer
    "Alphavantage, US";
    older
    change the the type to "Unknown"
    and the source to "alphavantage".

If using "Yahoo as JSON" or "Yahoo as YQL"[1] for a non-US stock, you may have to append a suffix to the end of the stock symbol to tell Finance::Quote what stock exchange the stock is listed on. E.g. CBA.AX gets the quote price for stock CBA on the Australian Stock Exchange in currency AUD. See Exchanges and data providers on Yahoo Finance.

Tip
you can still test currencies by
gnc-fq-dump -v yahoo_json USDEUR=X

Finance::Quote Sources

This chapter gives you some background information about Finance::Quote. Due to nature of gathering finance quotes (web scrapping, unstable API) the list of quote sources is constantly evolving.

Some modules are considered Active, that means it should be possible to fetch quotes using them. Please see #Active Individual Quote Sources and #Active Multiple Quote Sources for detailed lists.

Some sources may be considered obsolete that means that support for them has been removed (or is being removed), or they are not functioning correctly. Please see #Obsolete Individual Quote Sources and #Obsolete Multiple Quote Sources for detailed list.

If a particular source is the only place where the quote can be obtained but it's been failing or is obsolete, please reach out to Finance::Quote maintainers at https://github.com/finance-quote/finance-quote.

There are 3 types of sources of which the first - currency - is hardcoded and responsible to fetch ISO currencies. The other two can be selected in the Tools->Security Editor.

Finance::Quote Sources - Currency Source

Currency source for Finance::Quote
GnuCash Name Finance::Quote Name Notes
Currency currency End of 2017 the provider changed. Make sure, you updated F::Q to at least version 1.47 and follow the instructions at AlphaVantage below.

Finance::Quote Sources - Individual Sources

Active Individual Quote Sources

Individual sources for quotes
GnuCash Name Finance::Quote Name URL, Notes
AlphaVantage alphavantage API Key Required
  1. Register at https://www.alphavantage.co/ and
  2. Store the key which you got there in Edit->Preferences tab Online Quotes.

Watch the restrictions of the Free API Key in their FAQ!

Amsterdam Euronext eXchange, NL aex https://live.euronext.com

includes former sources AEX-“Futures” and -“Options”

Association of Mutual Funds In India, IN amfiindia https://www.amfiindia.com
Athens Stock Exchange, GR asegr https://www.athexgroup.gr
Australian Stock Exchange, AU asx https://www.asx.com.au

Requires at least F::Q 1.41 to get quotes for stocks starting with 'X', like “XRO”, which are not indices.

Bloomberg bloomberg https://www.bloomberg.com
Italian Stock Exchange, IT borsa_italiana https://www.borsaitaliana.it
BSE India (formerly known as Bombay Stock Exchange Ltd.), IN bseindia https://www.bseindia.com
Bucharest Stock Exchange, RO bvb or tradeville https://www.bvb.ro
Colombo Stock Exchange, LK cse https://www.cse.lk
comdirect, DE comdirect https://www.comdirect.de
Consors Bank, DE consorsbank https://www.consorsbank.de
Deka Investments, DE deka https://www.deka.de
DWS, DE dwsfunds https://www.dws.de
Financial Times Funds service, GB ftfunds https://funds.ft.com
Finanzpartner, DE finanzpartner https://www.finanzpartner.de
FondsWeb, DE fondsweb https://www.fondsweb.com
GoldMoney precious metals goldmoney https://www.goldmoney.com
Google Web, US Stocks googleweb or bats https://www.google.com/finance
IEX (Investors Exchange), US iexcloud API Key Required
  1. Register at https://iexcloud.io and
  2. Export the key as IEXCLOUD_API_KEY environment variable before starting GnuCash.

Watch the restrictions of the Free API Key in their pricing info!

MarketWatch marketwatch https://www.marketwatch.com
Morningstar, CH morningstarch https://www.morningstar.ch
Morningstar, GB morningstaruk or mstaruk https://morningstar.co.uk
Morningstar, JP morningstarjp https://www.morningstar.co.jp
Motley Fool, US fool https://www.fool.com
New Zealand stock eXchange, NZ nzx https://www.nzx.com
NSE (National Stock Exchange), IN nseindia https://www.nseindia.com
OnVista, DE onvista https://www.onvista.de
Paris Stock Exchange/Boursorama, FR bourso https://www.boursorama.com
S-Investor, DE sinvestor https://web.s-investor.de
Sharenet, ZA za https://www.sharenet.co.za
SIX Swiss Exchange, CH six https://www.six-group.com

includes former sources sixfunds and sixshares

Skandinaviska Enskilda Banken funds, SE seb_funds https://www.seb.se

Consult https://taz.vv.sebank.se/cgi-bin/pts3/pow/Fonder/kurser/kurslista_body.asp for all available funds.

StockData stockdata API Key Required
  1. Register at https://www.stockdata.org and
  2. Export the key as STOCKDATA_API_KEY environment variable before starting GnuCash.

Watch the restrictions of the Free API Key in their pricing info!

Stooq, PL stooq https://stooq.com
T. Rowe Price, US troweprice or troweprice_direct https://www.troweprice.com
Tesouro Direto bonds, BR tesouro_direto https://www.tesourodireto.com.br
TIAA-CREF, US tiaacref https://www.tiaa-cref.org
Toronto Stock eXchange, CA tsx or tmx https://money.tmx.com
Tradegate, DE tradegate Part of https://web.s-investor.de
Treasury Direct bonds, US treasurydirect https://www.treasurydirect.gov
Twelve Data twelvedata API Key Required
  1. Register at https://twelvedata.com and
  2. Export the key as TWELVEDATA_API_KEY environment variable before starting GnuCash.

Watch the restrictions of the Free API Key in their pricing info!

Union Investment, DE unionfunds https://www.union-invest.de
US Govt. Thrift Savings Plan, US tsp https://www.tsp.gov
XETRA, DE xetra Part of https://web.s-investor.de
Yahoo as JSON, US yahoo_json https://finance.yahoo.com/ through "JavaScript Object Notation" (query1/v7)
Yahoo, US yahooweb https://finance.yahoo.com/ through "JavaScript Object Notation" (query2/v1)
YH Finance (FincanceAPI) financeapi API Key Required
  1. Register at https://financeapi.net and
  2. Store the key which you got there in Edit->Preferences tab Online Quotes.

Watch the restrictions of the Free API Key in their pricing info!

Obsolete Individual Quote Sources

Obsolete individual sources for quotes
GnuCash Name Finance::Quote Name URL, Notes
American International Assurance, HK aiahk https://www.aia.com.hk
BAMOSZ funds, HU bamosz https://www.bamosz.hu
BMO NesbittBurns, CA bmonesbittburns https://bmonesbittburns.com
Budapest Stock Exchange (BET), ex-BUX, HU bse or bet https://www.bet.hu
Citywire Funds, GB citywire https://citywire.co.uk
Cominvest Asset Management, ex-Adig, DE cominvest The Commerzbank AG changed their structure, use their brand comdirect now.
Equinox Unit Trusts, ZA za_unittrusts https://www.equinox.co.za
Fidelity Investments, US fidelity_direct https://www.fidelity.com
Fidelity Fixed, US fidelityfixed https://www.fidelity.com/fixed-income-bonds/overview
Finance Canada financecanada https://finance.canada.com
First Trust Portfolios, US ftportfolios_direct https://www.ftportfolios.com
Fund Library, CA fundlibrary https://www.fundlibrary.com

This module uses an id that represents the mutual fund on https://www.fundlibrary.com . There is no easy way of fetching the id except to jump onto the fundlibrary website, look up the fund and view the url for clues to its id number.

HElsinki stock eXchange, FI hex https://www.hex.com
Man Investments, AU maninv https://www.maninvestments.com.au
Morningstar, SE morningstar https://www.morningstar.se
Paris Stock Exchange/LeRevenu, FR lerevenu https://bourse.lerevenu.com
Platinum Asset Management, AU platinum https://www.platinum.com.au
SIX Swiss Exchange Funds, CH sixfunds Part of https://www.six-group.com
SIX Swiss Exchange Shares, CH sixshares Part of https://www.six-group.com
StockHouse Canada, CA stockhousecanada_fund https://www.stockhouse.ca
TD Waterhouse Funds, CA tdwaterhouse https://www.tdassetmanagement.com
TD Efunds, CA tdefunds https://www.tdwaterhouse.ca
Trustnet via tnetuk.pm, GB tnetuk https://www.trustnet.com
Trustnet via trustnet.pm, GB trustnet https://www.trustnet.com
US Treasury Bonds, US usfedbonds https://www.publicdebt.treas.gov
Vanguard, US vanguard part of AlphaVantage
VWD, DE (unmaintained) vwd See https://lists.gnucash.org/pipermail/gnucash-user/2008-February/023686.html
Yahoo USA

Yahoo Asia

Yahoo Australia

Yahoo Brasil

Yahoo Europe

Yahoo New Zealand

yahoo

yahoo_asia

yahoo_australia

yahoo_brasil

yahoo_europe

yahoo_nz

CSV interface since 2017-11-01 shut off
Yahoo as YQL, US yahoo_yql https://finance.yahoo.com/ through "Yahoo Query Language"
Zuerich Investments (replaced) zifunds Zürich Invest has been purchased by Deutsche Bank and integrated into DWS.

Finance::Quote Sources - Multiple sources

Here the first successful result of a list of sources gets returned.

Active Multiple Quote Sources

Multiple sources for quotes
Name
Australia (ASX)
Canada (AlphaVantage, TMX)
Dutch (AEX)
Europe (ASEGR, Bourso, BVB, Consorsbank, Sinvestor, Stooq, Tradegate, XETRA)
France (Bourso)
Greece (ASEGR)
India Mutual (AMFI)
Nasdaq (AlphaVantage, FinanceAPI, Fool, GoogleWeb, IEXCloud, MarketWatch, StockData, YahooJSON)
NYSE (AlphaVantage, FinanceAPI, Fool, GoogleWeb, IEXCloud, MarketWatch, StockData, YahooJSON)
Poland (Stooq)
Romania (BVB)
South Africa (Sharenet)
T. Rowe Price
U.K. Funds (FTfunds, MorningStarUK)
USA (AlphaVantage, FinanceAPI, Fool, IEXCloud, YahooJSON)

Obsolete Multiple Quote Sources

Obsolete Multiple sources for quotes
Name
Asia disappeared with Yahoo
Brasil disappeared with Yahoo
Fidelity (Fidelity, ...)
Finland (HEX, ...)
First Trust (First Trust, ...)
Hungary (Bamosz, BET, ...)
New Zealand (NZX, ...)
U.K. Unit Trusts (trustnet, ...)

Sources: libgnucash/engine/gnc-commodity.cpp Adjusted for Finance::Quote 1.63, GnuCash-Wiki, bugzilla, mailing list archive.

Details of Some Finance::Quote Sources

Yahoo Specifics

Yahoo has offered quotes from many exchanges and markets. Alphavatage will behave similar but without delay. If you are not asking for US markets, you have to specify where to look. A typical Yahoo symbol has the form {<ISIN>|<ticker>}<market suffix>.

Dots in Ticker Symbols

Because Yahoo uses the dot . as separator for the market, dots in symbols like in “BT.A” at the London Stock Exchange are replaced by dash - resulting in “BT-A.L”.


Yahoo Codes for Exchanges and Markets
Country Market or Index Suffix Delay
Argentina Buenos Aires Stock Exchange (BYMA) .BA 30 min
Australia Australian Stock Exchange .AX 20 min
Austria Vienna Stock Exchange .VI 15 min
Belgium Euronext Brussels .BR 15 min
Brazil Sao Paolo Stock Exchange (BOVESPA) .SA 15 min
Canada Canadian Securities ExchangeToronto Stock Exchange .CN 15 min
Canada NEO Exchange .NE Real-time
Canada Toronto Stock Exchange .TO 15 min
Canada TSX Venture Exchange (TSXV) .V 15 min
Chile Santiago Stock Exchange .SN 15 min
China Shanghai Stock Exchange .SS 30 min
China Shenzhen Stock Exchange .SZ 30 min
Czech Republic Prague Stock Exchange Index .PR 20 min
Denmark Nasdaq OMX Copenhagen .CO Real-time
Egypt Egyptian Exchange Index (EGID) .CA 20 min
Estonia Nasdaq OMX Tallinn .TL Real-time
Finland Nasdaq OMX Helsinki .HE Real-time
France Euronext .NX 15 min
France Euronext Paris .PA 15 min
Germany Berlin Stock Exchange .BE 15 min
Germany Bremen Stock Exchange .BM 15 min
Germany Dusseldorf Stock Exchange .DU 15 min
Germany Frankfurt Stock Exchange .F 15 min
Germany Hamburg Stock Exchange .HM 15 min
Germany Hanover Stock Exchange .HA 15 min
Germany Munich Stock Exchange .MU 15 min
Germany Stuttgart Stock Exchange .SG 15 min
Germany Deutsche Boerse XETRA .DE 15 min
Global Currency Rates =X Real-time
Greece Athens Stock Exchange (ATHEX) .AT 15 min
Hong Kong Hong Kong Stock Exchange (HKEX) .HK 15 min (Real-time in HK)
Hungary Budapest Stock Exchange .BD 15 min
Iceland Nasdaq OMX Iceland .IC Real-time
India Bombay Stock Exchange .BO Real-time
India National Stock Exchange of India .NS Real-time**
Indonesia Indonesia Stock Exchange (IDX) .JK 10 min
Ireland Euronext Dublin .IR 15 min
Israel Tel Aviv Stock Exchange .TA 20 min
Italy EuroTLX .TI 20 min
Italy Italian Stock Exchange, former Milano .MI 20 min
Japan Nikkei Indices N/A 30 min
Japan Tokyo Stock Exchange .T 20 min
Latvia Nasdaq OMX Riga .RG Real-time
Lithuania Nasdaq OMX Vilnius .VS Real-time
Malaysia Malaysian Stock Exchange .KL 15 min
Mexico Mexico Stock Exchange (BMV) .MX 20 min
Netherlands Euronext Amsterdam .AS 15 min
New Zealand New Zealand Stock Exchange (NZX) .NZ 20 min
Norway Oslo Stock Exchange .OL 15 min
Portugal Euronext Lisbon .LS 15 min
Qatar Qatar Stock Exchange .QA 15 min
Russia Moscow Exchange (MOEX) .ME Real-time
Singapore Singapore Stock Exchange .SI 20 min
South Africa Johannesburg Stock Exchange .Jo 15 min
South Korea Korea Stock Exchange .KS 20 min
South Korea KOSDAQ .KQ 20 min
Spain Madrid SE C.A.T.S. .MC 15 min
Saudi Arabia Saudi Stock Exchange (Tadawul) .SAU 15 min
Sweden Nasdaq OMX Stockholm .ST Real-time
Switzerland Swiss Exchange (SIX) .SW 30 min
Taiwan Taiwan OTC Exchange .TWO 20 min
Taiwan Taiwan Stock Exchange (TWSE) .TW 20 min
Thailand Stock Exchange of Thailand (SET) .BK 15 min
Turkey Borsa İstanbul .IS 15 min
United Kingdom FTSE Indices N/A 15 min
United Kingdom London Stock Exchange .L 20 min
United Kingdom London Stock Exchange .IL 20 min
United States of America Chicago Board of Trade (CBOT) .CBT 10 min
United States of America Chicago Mercantile Exchange (CME) .CME 10 min
United States of America Dow Jones Indexes N/A Real-time
United States of America NASDAQ Stock Exchange N/A Real-time*
United States of America ICE Futures US, former New York Board of Trade .NYB 30 min
United States of America New York Commodities Exchange (COMEX) .CMX 30 min
United States of America New York Mercantile Exchange (NYMEX) .NYM 30 min
United States of America Options Price Reporting Authority (OPRA) N/A 15 min
United States of America OTC Bulletin Board Market N/A Real-time
United States of America OTC Markets Group N/A 15 min
United States of America S & P Indices N/A Real-time
Venezuela Caracas Stock Exchange .CR 15 min

Source: https://help.yahoo.com/kb/SLN2310.html?redirect=true queried at 2020-04-14.

TIAA-CREF Specifics

TIAA-CREF Annuities are not listed on any exchange, unlike their mutual funds TIAA-CREF provides unit values via a cgi on their website. The cgi returns a csv file in the format
bogus_symbol1,price1,date1
            bogus_symbol2,price2,date2
            …

where <bogus_symbol> takes on the following values for the various annuities:


The symbols are case-sensitive and changed their capitalization in the last time.


Pseudo-symbols that can be used for TIAA-CREF quotes
Name Symbol bogus
CREF Bond Market Account CREFbond 41081991
CREF Equity Index Account CREFequi 41082540
CREF Global Equities Account CREFglob 41081992
CREF Growth Account CREFgrow 41082544
CREF Inflation-Linked Bond Account CREFinfb 41088773
CREF Money Market Account CREFmony 41081993
CREF Social Choice Account CREFsoci 41081994
CREF Stock Account CREFstok 41081995
TIAA Real Estate Account TIAAreal 41091375
TIAA-CREF Bond Fund (Retirement) TIDRX 4530828
TIAA-CREF Bond Index Fund (Retirement) TBIRX 20739662
TIAA-CREF Bond Plus Fund (Retirement) TCBRX 4530816
TIAA-CREF Emerging Markets Equity Fund (Retirement) TEMSX 26176543
TIAA-CREF Emerging Markets Equity Index Fund (Retirement) TEQSX 26176547
TIAA-CREF Equity Index Fund (Retirement) TIQRX 4530786
TIAA-CREF Global Natural Resources Fund (Retirement) TNRRX 39444919
TIAA-CREF Growth & Income Fund (Retirement) TRGIX 312536
TIAA-CREF High Yield Fund (Retirement) TIHRX 4530821
TIAA-CREF Inflation-Linked Bond Fund (Retirement) TIKRX 4530829
TIAA-CREF International Equity Fund (Retirement) TRERX 302323
TIAA-CREF International Equity Index Fund (Retirement) TRIEX 300269
TIAA-CREF Large-Cap Growth Fund (Retirement) TILRX 4530785
TIAA-CREF Large-Cap Growth Index Fund (Retirement) TRIRX 299525
TIAA-CREF Large-Cap Value Fund (Retirement) TRLCX 301332
TIAA-CREF Large-Cap Value Index Fund (Retirement) TRCVX 304333
TIAA-CREF Lifecycle 2010 Fund (Retirement) TCLEX 302817
TIAA-CREF Lifecycle 2015 Fund (Retirement) TCLIX 302393
TIAA-CREF Lifecycle 2020 Fund (Retirement) TCLTX 307774
TIAA-CREF Lifecycle 2025 Fund (Retirement) TCLFX 313994
TIAA-CREF Lifecycle 2030 Fund (Retirement) TCLNX 307240
TIAA-CREF Lifecycle 2035 Fund (Retirement) TCLRX 309003
TIAA-CREF Lifecycle 2040 Fund (Retirement) TCLOX 300959
TIAA-CREF Lifecycle 2045 Fund (Retirement) TTFRX 9467597
TIAA-CREF Lifecycle 2050 Fund (Retirement) TLFRX 9467596
TIAA-CREF Lifecycle 2055 Fund (Retirement) TTRLX 34211330
TIAA-CREF Lifecycle Index 2010 Fund (Retirement) TLTRX 21066482
TIAA-CREF Lifecycle Index 2015 Fund (Retirement) TLGRX 21066496
TIAA-CREF Lifecycle Index 2020 Fund (Retirement) TLWRX 21066479
TIAA-CREF Lifecycle Index 2025 Fund (Retirement) TLQRX 21066485
TIAA-CREF Lifecycle Index 2030 Fund (Retirement) TLHRX 21066435
TIAA-CREF Lifecycle Index 2035 Fund (Retirement) TLYRX 21066475
TIAA-CREF Lifecycle Index 2040 Fund (Retirement) TLZRX 21066473
TIAA-CREF Lifecycle Index 2045 Fund (Retirement) TLMRX 21066488
TIAA-CREF Lifecycle Index 2050 Fund (Retirement) TLLRX 21066490
TIAA-CREF Lifecycle Index 2055 Fund (Retirement) TTIRX 34211328
TIAA-CREF Lifecycle Index Retirement Income Fund (Retirement) TRCIX 21066468
TIAA-CREF Lifecycle Retirement Income Fund (Retirement) TLIRX 9467594
TIAA-CREF Lifestyle Aggressive Growth Fund (Retirement) TSARX 40508431
TIAA-CREF Lifestyle Conservative Fund (Retirement) TSCTX 40508433
TIAA-CREF Lifestyle Growth Fund (Retirement) TSGRX 40508437
TIAA-CREF Lifestyle Income Fund (Retirement) TLSRX 40508427
TIAA-CREF Lifestyle Moderate Fund (Retirement) TSMTX 40508460
TIAA-CREF Managed Allocation Fund (Retirement) TITRX 4530825
TIAA-CREF Mid-Cap Growth Fund (Retirement) TRGMX 305499
TIAA-CREF Mid-Cap Value Fund (Retirement) TRVRX 315272
TIAA-CREF Money Market Fund (Retirement) TIEXX 4530771
TIAA-CREF Real Estate Securities Fund (Retirement) TRRSX 300081
TIAA-CREF S&P 500 Index Fund (Retirement) TRSPX 306105
TIAA-CREF Short-Term Bond Fund (Retirement) TISRX 4530818
TIAA-CREF Small-Cap Blend Index Fund (Retirement) TRBIX 314644
TIAA-CREF Small-Cap Equity Fund (Retirement) TRSEX 299968
TIAA-CREF Social Choice Equity Fund (Retirement) TRSCX 300078
TIAA-CREF Bond Fund (Institutional) TIBDX 307276
TIAA-CREF Bond Index Fund (Institutional) TBIIX 20739664
TIAA-CREF Bond Plus Fund (Institutional) TIBFX 4530820
TIAA-CREF Emerging Markets Equity Fund (Institutional) TEMLX 26176540
TIAA-CREF Emerging Markets Equity Index Fund (Institutional) TEQLX 26176544
TIAA-CREF Enhanced International Equity Index Fund (Institutional) TFIIX 9467603
TIAA-CREF Enhanced Large-Cap Growth Index Fund (Institutional) TLIIX 9467602
TIAA-CREF Enhanced Large-Cap Value Index Fund (Institutional) TEVIX 9467606
TIAA-CREF Equity Index Fund (Institutional) TIEIX 301718
TIAA-CREF Global Natural Resources Fund (Institutional) TNRIX 39444916
TIAA-CREF Growth & Income Fund (Institutional) TIGRX 314719
TIAA-CREF High Yield Fund (Institutional) TIHYX 4530798
TIAA-CREF Inflation-Linked Bond Fund (Institutional) TIILX 316693
TIAA-CREF International Equity Fund (Institutional) TIIEX 305980
TIAA-CREF International Equity Index Fund (Institutional) TCIEX 303673
TIAA-CREF Large-Cap Growth Fund (Institutional) TILGX 4530800
TIAA-CREF Large-Cap Growth Index Fund (Institutional) TILIX 297809
TIAA-CREF Large-Cap Value Fund (Institutional) TRLIX 300692
TIAA-CREF Large-Cap Value Index Fund (Institutional) TILVX 302308
TIAA-CREF Lifecycle 2010 Fund (Institutional) TCTIX 4912376
TIAA-CREF Lifecycle 2015 Fund (Institutional) TCNIX 4912355
TIAA-CREF Lifecycle 2020 Fund (Institutional) TCWIX 4912377
TIAA-CREF Lifecycle 2025 Fund (Institutional) TCYIX 4912384
TIAA-CREF Lifecycle 2030 Fund (Institutional) TCRIX 4912364
TIAA-CREF Lifecycle 2035 Fund (Institutional) TCIIX 4912375
TIAA-CREF Lifecycle 2040 Fund (Institutional) TCOIX 4912387
TIAA-CREF Lifecycle 2045 Fund (Institutional) TTFIX 9467607
TIAA-CREF Lifecycle 2050 Fund (Institutional) TFTIX 9467601
TIAA-CREF Lifecycle 2055 Fund (Institutional) TTRIX 34211329
TIAA-CREF Lifecycle Index 2010 Fund (Institutional) TLTIX 21066484
TIAA-CREF Lifecycle Index 2015 Fund (Institutional) TLFIX 21066498
TIAA-CREF Lifecycle Index 2020 Fund (Institutional) TLWIX 21066480
TIAA-CREF Lifecycle Index 2025 Fund (Institutional) TLQIX 21066486
TIAA-CREF Lifecycle Index 2030 Fund (Institutional) TLHIX 21066495
TIAA-CREF Lifecycle Index 2035 Fund (Institutional) TLYIX 21066477
TIAA-CREF Lifecycle Index 2040 Fund (Institutional) TLZIX 21066474
TIAA-CREF Lifecycle Index 2045 Fund (Institutional) TLXIX 21066478
TIAA-CREF Lifecycle Index 2050 Fund (Institutional) TLLIX 21066492
TIAA-CREF Lifecycle Index 2055 Fund (Institutional) TTIIX 34211326
TIAA-CREF Lifecycle Index Retirement Income Fund (Institutional) TRILX 21066463
TIAA-CREF Lifecycle Retirement Income Fund (Institutional) TLRIX 9467595
TIAA-CREF Lifestyle Aggressive Growth Fund (Institutional) TSAIX 40508428
TIAA-CREF Lifestyle Conservative Fund (Institutional) TCSIX 40508425
TIAA-CREF Lifestyle Growth Fund (Institutional) TSGGX 40508434
TIAA-CREF Lifestyle Income Fund (Institutional) TSITX 40508450
TIAA-CREF Lifestyle Moderate Fund (Institutional) TSIMX 40508443
TIAA-CREF Managed Allocation Fund (Institutional) TIMIX 4530787
TIAA-CREF Mid-Cap Growth Fund (Institutional) TRPWX 297210
TIAA-CREF Mid-Cap Value Fund (Institutional) TIMVX 316178
TIAA-CREF Money Market Fund (Institutional) TCIXX 313650
TIAA-CREF Real Estate Securities Fund (Institutional) TIREX 303475
TIAA-CREF S&P 500 Index Fund (Institutional) TISPX 306658
TIAA-CREF Short-Term Bond Fund (Institutional) TISIX 4530784
TIAA-CREF Small-Cap Blend Index Fund (Institutional) TISBX 309018
TIAA-CREF Small-Cap Equity Fund (Institutional) TISEX 301622
TIAA-CREF Social Choice Equity Fund (Institutional) TISCX 301897
TIAA-CREF Tax-Exempt Bond Fund (Institutional) TITIX 4530819
TIAA-CREF Bond Fund (Retail) TIORX 4530794
TIAA-CREF Bond Index Fund (Retail) TBILX 20739663
TIAA-CREF Bond Plus Fund (Retail) TCBPX 4530788
TIAA-CREF Emerging Markets Equity Fund (Retail) TEMRX 26176542
TIAA-CREF Emerging Markets Equity Index Fund (Retail) TEQKX 26176545
TIAA-CREF Equity Index Fund (Retail) TINRX 4530797
TIAA-CREF Global Natural Resources Fund (Retail) TNRLX 39444917
TIAA-CREF Growth & Income Fund (Retail) TIIRX 4530790
TIAA-CREF High Yield Fund (Retail) TIYRX 4530830
TIAA-CREF Inflation-Linked Bond Fund (Retail) TCILX 313727
TIAA-CREF International Equity Fund (Retail) TIERX 4530827
TIAA-CREF Large-Cap Growth Fund (Retail) TIRTX 4530791
TIAA-CREF Large-Cap Value Fund (Retail) TCLCX 302696
TIAA-CREF Lifecycle Retirement Income Fund (Retail) TLRRX 9467600
TIAA-CREF Lifestyle Aggressive Growth Fund (Retail) TSALX 40508429
TIAA-CREF Lifestyle Conservative Fund (Retail) TSCLX 40508432
TIAA-CREF Lifestyle Growth Fund (Retail) TSGLX 40508435
TIAA-CREF Lifestyle Income Fund (Retail) TSILX 40508438
TIAA-CREF Lifestyle Moderate Fund (Retail) TSMLX 40508453
TIAA-CREF Managed Allocation Fund (Retail) TIMRX 4530817
TIAA-CREF Mid-Cap Growth Fund (Retail) TCMGX 305208
TIAA-CREF Mid-Cap Value Fund (Retail) TCMVX 313995
TIAA-CREF Money Market Fund (Retail) TIRXX 4530775
TIAA-CREF Real Estate Securities Fund (Retail) TCREX 309567
TIAA-CREF Short-Term Bond Fund (Retail) TCTRX 4530822
TIAA-CREF Small-Cap Equity Fund (Retail) TCSEX 297477
TIAA-CREF Social Choice Equity Fund (Retail) TICRX 4530792
TIAA-CREF Tax-Exempt Bond Fund (Retail) TIXRX 4530793
TIAA-CREF Bond Fund (Premier) TIDPX 21066506
TIAA-CREF Bond Index Fund (Premier) TBIPX 21066534
TIAA-CREF Bond Plus Fund (Premier) TBPPX 21066533
TIAA-CREF Emerging Markets Equity Fund (Premier) TEMPX 26176541
TIAA-CREF Emerging Markets Equity Index Fund (Premier) TEQPX 26176546
TIAA-CREF Equity Index Fund (Premier) TCEPX 21066530
TIAA-CREF Global Natural Resources Fund (Premier) TNRPX 39444918
TIAA-CREF Growth & Income Fund (Premier) TRPGX 21066461
TIAA-CREF High Yield Fund (Premier) TIHPX 21066501
TIAA-CREF Inflation-Linked Bond Fund (Premier) TIKPX 21066500
TIAA-CREF International Equity Fund (Premier) TREPX 21066466
TIAA-CREF International Equity Index Fund (Premier) TRIPX 21066462
TIAA-CREF Large-Cap Growth Fund (Premier) TILPX 21066499
TIAA-CREF Large-Cap Value Fund (Premier) TRCPX 21066467
TIAA-CREF Lifecycle 2010 Fund (Premier) TCTPX 21066521
TIAA-CREF Lifecycle 2015 Fund (Premier) TCFPX 21066528
TIAA-CREF Lifecycle 2020 Fund (Premier) TCWPX 21066518
TIAA-CREF Lifecycle 2025 Fund (Premier) TCQPX 21066522
TIAA-CREF Lifecycle 2030 Fund (Premier) TCHPX 21066527
TIAA-CREF Lifecycle 2035 Fund (Premier) TCYPX 21066517
TIAA-CREF Lifecycle 2040 Fund (Premier) TCZPX 21066516
TIAA-CREF Lifecycle 2045 Fund (Premier) TTFPX 21066444
TIAA-CREF Lifecycle 2050 Fund (Premier) TCLPX 21066526
TIAA-CREF Lifecycle 2055 Fund (Premier) TTRPX 34211331
TIAA-CREF Lifecycle Index 2010 Fund (Premier) TLTPX 21066483
TIAA-CREF Lifecycle Index 2015 Fund (Premier) TLFPX 21066497
TIAA-CREF Lifecycle Index 2020 Fund (Premier) TLWPX 21066434
TIAA-CREF Lifecycle Index 2025 Fund (Premier) TLVPX 21066481
TIAA-CREF Lifecycle Index 2030 Fund (Premier) TLHPX 21066494
TIAA-CREF Lifecycle Index 2035 Fund (Premier) TLYPX 21066476
TIAA-CREF Lifecycle Index 2040 Fund (Premier) TLPRX 21066487
TIAA-CREF Lifecycle Index 2045 Fund (Premier) TLMPX 21066489
TIAA-CREF Lifecycle Index 2050 Fund (Premier) TLLPX 21066491
TIAA-CREF Lifecycle Index 2055 Fund (Premier) TTIPX 34211327
TIAA-CREF Lifecycle Index Retirement Income Fund (Premier) TLIPX 21066493
TIAA-CREF Lifecycle Retirement Income Fund (Premier) TPILX 21066470
TIAA-CREF Lifestyle Aggressive Growth Fund (Premier) TSAPX 40508430
TIAA-CREF Lifestyle Conservative Fund (Premier) TLSPX 40508426
TIAA-CREF Lifestyle Growth Fund (Premier) TSGPX 40508436
TIAA-CREF Lifestyle Income Fund (Premier) TSIPX 40508451
TIAA-CREF Lifestyle Moderate Fund (Premier) TSMPX 40508456
TIAA-CREF Mid-Cap Growth Fund (Premier) TRGPX 21066464
TIAA-CREF Mid-Cap Value Fund (Premier) TRVPX 21066455
TIAA-CREF Money Market Fund (Premier) TPPXX 21066469
TIAA-CREF Real Estate Securities Fund (Premier) TRRPX 21066459
TIAA-CREF Short-Term Bond Fund (Premier) TSTPX 21066445
TIAA-CREF Small-Cap Equity Fund (Premier) TSRPX 21066446
TIAA-CREF Social Choice Equity Fund (Premier) TRPSX 21066460

Source: Comments in https://rt.cpan.org/Ticket/Attachment/1121440/589997/Tiaacref.pm.zip


Updating enabled Quotes from outside GnuCash

To update all enabled quotes, you can run

GnuCash 4.0 and later
Linux
gnucash-cli --quotes get /path/to/file.gnucash
macOS
/Applications/Gnucash.app/Contents/MacOS/gnucash-cli --quotes get /Users/<username>/Documents/test.gnucash
Windows
gnucash-cli.exe --quotes get file://C:/path/to/file.gnucash
GnuCash 3.11 and earlier
Linux
gnucash --add-price-quotes /path/to/file.gnucash
macOS
/Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes /Users/<username>/Documents/test.gnucash
Windows
gnucash.exe --add-price-quotes file://C:/path/to/file.gnucash

Warnings

Windows Paths

On Windows if the path includes a "disk letter" then you must pass a "file URI" or GnuCash will confuse the drive letter for an URI scheme and fail to open it. e.g. file://C:/path/to/file.gnucash

Open Files

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

Multiple Perl installations on macOS

GnuCash was designed to work on a macOS system with only the Apple-supplied Perl installation, which is in /usr/bin/perl. Some macOS users may install another copy of Perl, via package managers like MacPorts or Homebrew, or directly. Usually, these installations have their own location for installing modules like Finance::Quote. They do not consult the system location.

macOS invokes the GnuCash GUI application in a way which leads it to the Apple-supplied Perl installation, even if others are present. Also, gnc-fq-update always installs Finance::Quote to this this location. However, when you invoke gnucash-cli from a Terminal command line, it uses whichever Perl installation your search path $PATH leads it to.

If you have multiple Perl installations on a macOS system, gnucash-cli might use a different Perl installation, and a different set of modules, than the GnuCash GUI application uses. To find out which copy of perl runs, run the command: which perl

So, either be sure that your Terminal environment invokes the Apple-supplied Perl installation in /usr/bin/perl (probably by using a different $PATH), or be sure that Finance::Quote is also installed in the Perl installation which your Terminal environment uses.

If you are using MacPorts, there is a port for Finance::Quote. Install it using the MacPorts command:

sudo port install p5-finance-quote

To see which in directories a Perl installation looks for modules, run the command:

perl -e 'print join("\n", @INC), "\n";'

The Apple-supplied Perl installation usually lists directories in /Library/Perl, /Network/Library/Perl, and /System/Library/Perl. A MacPorts Perl installation will list directories in /opt/local/lib/perl5/.

Cron and Non-X Usage - Linux & macOS (macOS TBC?)

If you attempt to do that 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:

GnuCash 4.0 and later

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

GnuCash 3.11 and earlier

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.

Importing Historical Prices or Quotes

If your GnuCash version is built with Python Bindings, you can use the scripts shown on these pages:

Windows and macOS builds do not include Python Bindings.

Technical Details

The technical details of Finance::Quote and how GnuCash uses it differ depending on which OS or distribution you use.

On most systems, you can get the path where Finance::Quote is installed by running:

perldoc -lm Finance::Quote

You can list the directories where Perl looks for modules using the simple Perl program:

perl -e 'print join("\n", @INC), "\n";'

Technical details on Linux

Finance::Quote is stored where your system stores other Perl modules. This location depends on the installation method which was used.

  • installed by package manager: in /usr/share/perl5/Finance or /usr/share/perl5/vendor/Finance
  • installed by CPAN or by gnc-fq-update: /usr/share/perl5/site/Finance
  • if you compiled and installed from source: /usr/local/share/perl/5.xx.x/Finance

Technical details on Windows

Strawberry Perl's location for Perl modules is C:\Strawberry\perl\site\lib\Finance .

Technical details on macOS

The Apple-supplied Perl installation has the Perl executable at /usr/bin/perl. It stores modules at /Library/Perl/5.xx/Finance, where xx depends on the version of Perl in use when you installed Finance::Quote.

Install Finance::Quote to the system location using
sudo gnc-fq-update
or
sudo cpan -i

When you upgrade macOS, you may have to reinstall Finance::Quote. This is because the newer macOS version may have a newer Perl version, which will have a different xx in the path to the module storage location. The older version directories are not included in Perl's path to this location (via @INC).

For macOS Version 11.6 (Big Sur) Finance::Quote may be inoperable due to missing modules. Use the following commands to correct the problem:

sudo cpan -i B::Keywords
sudo cpan -i Test2
sudo cpan -i DateTime
sudo cpan -i DateTime::Locale
sudo cpan -i DateTime::Format::Strptime
sudo cpan -i Mozilla::CA

Once these modules have been installed, it's probably best to repeat the GnuCash supplied installation again

cd /Applications/Gnucash/Contents/Resources/bin
sudo ./gnc-fq-update

If you have installed Perl via MacPorts or Homebrew, you probably have multiple Perl installations on your system. Each installation has its own set of modules. You may need to install Finance::Quote in each of these locations. See Multiple Perl installations on macOS above for advice.

The reason is that GnuCash installs two executables in macOS: the GnuCash GUI application, and a command-line application gnucash-cli. If you have multiple Perl installations, you may find that these executables use different Perl installations. This is because the GUI apps are started by the macOS LaunchServices, which uses a standard environment and standard search path, while command-line applications use the environment and search path which you customised using your shell's startup files. The straightforward way to use gnucash-cli to retrieve quotes is to install a second copy of Finance::Quote in the Perl installation which it finds.

MacPorts has a port p5-finance-quote. Install this port to make Finance::Quote available to the MacPorts-supplied Perl installation:
sudo port install p5-finance-quote

Within p5-finance-quote are subports specific to Perl versions, e.g. p5.26-finance-quote and p5.28-finance-quote. It is these subports which actually install the Finance::Quote module. When you install p5-finance-quote, MacPorts installs the appropriate subports, and necessary other Perl modules.

To find out more about the Finance::Quote ports and subports provided by MacPorts, use the command:
port info p5\*-finance-quote
To find out which files MacPorts installed into which directory, use the command:
port contents installed and p5\*-finance-quote

Homebrew provides ways to install Perl modules. See Gems, Eggs and Perl Modules in the Homebrew documentation. [We welcome people who use both GnuCash and a Homebrew installation of Perl to flesh out this description. —Editors]

If you install Perl using Homebrew, be aware that Homebrew does not preserve modules across Perl updates. After you update Perl with Homebrew, reinstall Finance::Quote.

Trouble Shooting

See Command Line Interface above for more information on using gnucash-cli on your platform.

GnuCash 5.x and newer

The Get Quotes button in Price Editor isn't enabled

This can also manifest as a warning about Finance Quote not being installed correctly in Security Editor dialog boxes. Run

  gnucash-cli --quotes info

If it presents its usual output then there is something different about the perl environment in the terminal shell than when starting GnuCash from the Desktop. Try running gnucash from the terminal, using the same path if any that you use for gnucash-cli (exception: on macOS it's capitalized, i.e. /Applications/Gnucash.app/Contents/macOS/Gnucash). If that works, look for environment differences between the desktop environment and your shell environment, paying particular attention to $PATH and $PERL5DOC.

If instead you get a bunch of errors there's something wrong with your Finance::Quote installation. The errors might offer a clue: For example, you might find

  Can't locate DateTime/Format/Strptime.pm in @INC (you may need to install the DateTime::Format::Strptime module)

and you can use

  sudo cpan -i DateTime::Format::Strptime

to install it. macOS users with Apple Silicon Macs should see [#Installing Finance::Quote on macOS from a Terminal prompt] for special considerations. Microsoft Windows users should use the cpan shell from the Start menu's Strawberry Perl folder and tell it

   install DateTime::Format::Strptime

If you need help understanding the errors, ask on one of the user mailing lists.

Get Quotes fails for some symbols

Run

   gnucash-cli --quotes dump <source> <symbol>

substituting the symbol and its source in the indicated places, for example

   gnucash-cli --quotes dump fool AAPL

to retrieve a quote for Apple, Inc. from the Motley Fool website. A successful retrieval will look like

   Finance::Quote fields GnuCash uses:
       symbol: AAPL            <=== required
         date: 12/22/2023      <=== recommended
     currency: USD             <=== required
         last: 193.60          <=\
          nav:                 <=== one of these
        price:                 <=/

A failure will return a similar block with required fields empty or an error message like

   Finance::Quote reported a failure for symbol BRK: Not Found

In the former case you can use

   gnucash-cli --verbose --quotes dump fool AAPL

to see all of the fields that Finance::Quote returns. You can also bypass GnuCash and query Finance::Quote directly using stockdump.pl. Linux users who've installed Finance::Quote via their package manager can find it in the package info; for example in Debian it's installed at /usr/share/doc/libfinance-quote-perl/examples/stockdump.pl. If you installed Finanace::Quote using gnc-fq-update it will be in the cpan build directory, often $HOME/.cpan/build/Finance-Quote-<version>/examples/stockdump.pl. Windows users will find it in C:\Strawberry\cpan\build\Finance-Quote-<version>/examples/stockdump.pl. Use it like gnucash-cli --quotes:

   .cpan/build/Finance-Quote-1.58-0/Examples/stockdump.pl fool AAPL
   $VAR1 = {
             'AAPLsuccess' => 1,
             'AAPLsymbol' => 'AAPL',
             'AAPLopen' => '195.18',
             'AAPLmethod' => 'fool',
             'AAPLcurrency_set_by_fq' => 1,
             'AAPLdate' => '12/22/2023',
             'AAPLvolume' => '37149570',
             'AAPLcurrency' => 'USD',
             'AAPLisodate' => '2023-12-22',
             'AAPLclose' => '193.60',
             'AAPLyear_range' => '124.17 - 199.62',
             'AAPLlast' => '193.60',
             'AAPLday_range' => '192.97 - 195.41'
            };

If stockdump or gnucash-cli --verbose --quotes dump shows all the needed variables but gnucash-cli --quotes dump complains then there's a problem with interpreting the Finance::Quote output that you should bring to the attention of the developers. If it doesn't then there's a problem with the Finance::Quote source. You can report that on the tracker.

A Not Found error means that the source doesn't know about the symbol. That might be because you made a mistake in the symbol, because the source doesn't provide quotes for it, or because it no longer trades. Try searching financial websites for the company name to learn about company news and symbol or market changes.

You can get additional debugging messages from gnucash-cli by adding --log gnc.price-quotes=debug to the parameters. Passing the same to GnuCash will write the messages to the tracefile.

Alphavantage

Alphavantage has for several years limited the rate of queries for free accounts to 5 quotes per minute; as of late 2023 the limit is instead 25 quotes per day. They also require an API key; to get a free one here. Enter your API key in GnuCash Preferences; to use it with Finance::Quote directly you need to also create an environment variable ALPHAVANTAGE_API_KEY.

Yahoo JSON

Yahoo JSON offers a quotes on a huge range of symbols and is quite fast when it works. Unfortunately the URI has been unstable in 2022 and 2023 causing Finance::Quote to fail from time to time until someone can discover the new one and the Finance::Quote maintainers can update the module and do a new release. There's an ongoing concern that Yahoo's owners will close down the service.

Website Scraping

Most of the other sources work by scraping the HTML from the source's website. This is brittle because any formatting changes to the web page can break the scraping code. Report failures to the tracker.

GnuCash 4.x and older

Broken or outdated Finance::Quote installation

Try the steps below. After each step, run GnuCash and see if that solution resolved the problem of retrieving stock quotes.

Note for Microsoft Windows users to run perl scripts like gnc-fq-check
  1. Open a command line window:
    Windows 10 (not in Tablet Mode)
    1. Click in the Cortana Ask me anything field to the right of the Start button,
    2. begin typing cmd, a search menu should appear. The menu should display Command Prompt.
    3. Left-click or tap the Command Prompt icon.
    Windows 8 (or Windows 10 in Tablet Mode)
    From the Start screen, begin typing cmd, a search menu should appear. The menu should display Command Prompt. Left-click or tap the Command Prompt icon.
    Windows 7
    click Start button, type cmd in the Search programs and files field, press Enter
    Windows XP
    click Start button, All Programs, Accessories, Command Prompt
  2. Change to the drive containing the GnuCash program files (usually C drive) if that is not already the current drive:
    C:
    
  3. Change to the ...\gnucash\bin directory which contains the required gnc-fq-xxx perl script:
    32 bit version of Windows
    cd \Program Files\gnucash\bin
    
    64 bit version of Windows
    cd \Program Files (x86)\gnucash\bin
    
  4. Prefix any gnc-fq-xxx perl script command with perl and a space:
    perl gnc-fq-check
    
  1. Windows only
    Recent versions of Finance::Quote require a more recent version of perl on Windows. If you encounter trouble with the installation, uninstall whichever perl you have, both with Start, Settings, Apps for recent versions of Windows (or Control Panel for older versions) and Windows Explorer (delete folder C:\Strawberry), then run Install Online Price Retrieval, which will install a recent version of Strawberry Perl for you. N.B.: You don't necessarily want to do that if you're using perl for other purposes, but in that case you probably already know how to upgrade perl.
  2. Make sure you're running the latest version of Finance::Quote. Use gnc-fq-check to check what version you are running. Compare this with the latest release at CPAN or Finance::Quote Releases. The CPAN link is a search, and Finance::Quote will be the first hit; the latest version number and release date are under the name.
    On Windows or macOS you can update to the latest F::Q release by running the Online Quote Retrieval Installation program again or from the Unix command line run gnc-fq-update. The providers periodically change interfaces and it's important to keep Finance::Quote up to date to deal with the changes.
    macOS only
    If the GnuCash GUI app can retrieve quotes but the command line gnucash-cli fails with a message, "No quotes retrieved. Finance::Quote isn't installed properly", then check to see if you have multiple Perl installations. If so, gnucash-cli may be using a different Perl installation than the GnuCash GUI app uses. See Multiple Perl installations on macOS above.
  3. Use gnc-fq-dump from the command line to check your F::Q sources and commodity symbols, and if a currency conversion rate is available between your Default Currency (see Preferences, Accounts) and other currencies used by accounts.
  4. If the output of the gnc-fq-dump command seems ok but Gnucash still fails to get the quote, run from a command line:
    Linux
    echo '(yahoo_json "CSCO")' | gnc-fq-helper
    
    macOS
    echo '(yahoo_json "CSCO")' | /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-helper
    
    Windows
    echo (yahoo_json "CSCO") | perl gnc-fq-helper
    
    You should get something that looks like (("CSCO" (symbol . "CSCO") ..... (currency . "USD"))). There you can also find bad things like trailing blanks.
    • gives an error message about a missing file instead, that's your problem. This is a dependency that gnucash doesn't know about and so doesn't check for it. You will need to satisfy the missing dependency.
    But usually, at least under linux, it helps to run
    gnc-fq-update
    
    as root.
    For Windows see also Windows Finance::Quote.
  5. Run gnucash from the command line with the --debug argument (see Tracefile), attempt a quote retrieval, and then contact the developers either via email to a User Mailing List or on IRC.
  6. Sometimes it might help to know what module Perl does actually load.
    This command will tell you exactly that for e.g. Tiaacref:
    perldoc -lm Finance::Quote::Tiaacref
    
  7. Check if your security software (virus scanner) blocks you as in this user report.
Diagnosing Finance::Quote failures

On files which contain many price quotes from different sources, it is sometimes not obvious which source failed, in particular if a generic error message is thrown, e.g. "There was a system error during retrieving price quotes".

To diagnose which requests are issued, start gnucash with additional log output

gnucash --log gnc.scm=debug

and get quotes with "Tools->Price Database->Get Quotes".

gnucash.trace (Linux: /tmp/gnucash.trace) contains the relevant log output, e.g.

* 11:31:01 DEBUG <gnc.scm> ALPHAVANTAGE_API_KEY=XXXXXXXXXXXXXXXXXX
* 11:31:01 DEBUG <gnc.scm> handling-request: (fondsweb LU0804734787 IE00BFNM3G45 DE0009769794 IE00BFNM3P36 FR0010524777 IE00BFNM3D14 DE0008476516 LU1136260384 IE00B3VWMM18 DE0009807008 LU0533033238 GB00B0H6D894 IE00B3RBWM25 LU0823414635 LU0119891520)
* 11:31:06 DEBUG <gnc.scm> results: ((LU0804734787 (symbol . LU0804734787) (gnc:time-no-zone . 2021-11-03 12:00:00) (last . 39303/100) (currency . EUR)) (IE00BFNM3G45 (symbol . IE00BFNM3G45) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 46/5) (currency . USD)) (DE0009769794 (symbol . DE0009769794) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 16107/100) (currency . EUR)) (IE00BFNM3P36 (symbol . IE00BFNM3P36) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 709/100) (currency . USD)) (FR0010524777 (symbol . FR0010524777) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 931/20) (currency . EUR)) (IE00BFNM3D14 (symbol . IE00BFNM3D14) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 181/25) (currency . EUR)) (DE0008476516 (symbol . DE0008476516) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 931/50) (currency . EUR)) (LU1136260384 (symbol . LU1136260384) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 1482/5) (currency . EUR)) (IE00B3VWMM18 (symbol . IE00B3VWMM18) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 14307/50) (currency . EUR)) (DE0009807008 (symbol . DE0009807008) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 1012/25) (currency . EUR)) (LU0533033238 (symbol . LU0533033238) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 21227/50) (currency . EUR)) (GB00B0H6D894 (symbol . GB00B0H6D894) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 763/50) (currency . EUR)) (IE00B3RBWM25 (symbol . IE00B3RBWM25) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 3103/25) (currency . USD)) (LU0823414635 (symbol . LU0823414635) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 69591/50) (currency . EUR)) (LU0119891520 (symbol . LU0119891520) (gnc:time-no-zone . 2021-11-04 12:00:00) (last . 36979/50) (currency . EUR)))
* 11:31:06 DEBUG <gnc.scm> handling-request: (alphavantage DAI.DE)
* 11:31:06 DEBUG <gnc.scm> results: #<eof>

Here the passing request to fondsweb is listed and the result as well as the failing request to alphavantage. As describe above this can be validated with gnc-fq-helper

$ echo '(alphavantage "DAI.DE")'|gnc-fq-helper
Can't use an undefined value as a HASH reference at /usr/share/perl5/Finance/Quote/AlphaVantage.pm line 228.
$ echo '(yahoo_json "DAI.DE")'|gnc-fq-helper
(("DAI.DE" (symbol . "DAI.DE") (gnc:time-no-zone . "2021-11-05 12:00:00") (last . #e87.59) (currency . "EUR")))
$

Documentation

Standards

Notes

  1. 1.0 1.1 1.2 1.3 On January 3, 2019 Yahoo retired the YQL API service. so Yahoo as YQL was removed from Finance::Quote 1.50.

Back to: Using GnuCash