Currency quotes work differently from stock quotes because forex markets 
operate differently from stock exchanges. A particular stock symbol on any one 
price source is unique and quoted in a single currency so only the symbol is 
needed to retrieve the quote. Forex markets quote exchange rates between pairs 
of currencies, e.g. GBP to USD or JPY to EUR. Simply asking for the current 
quote for EUR isn't meaningful.

In F::Q to retrieve currency quotes you must use `currency` for the source and 
you need two symbols as shown in Geoff's examples. Enabling online quotes for a 
currency in the security editor won't work because that will try to retrieve a 
price for a stock with the currency symbol from the selected source and odds 
are there is no such stock.

To easily test that F::Q is working for currencies 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.

Regards,
John Ralls

> On Jul 18, 2021, at 7:30 AM, david.rom...@davidjromano.com 
> <david.rom...@davidjromano.com> wrote:
> 
> Thanks Geoff, yes I think I did though I will recheck this.
> 
> I've also tried this with an alternative key in case the first was the 
> problem.
> 
> David 
> Sent from my iPhone
> 
>> On 18 Jul 2021, at 13:55, Geoff <cleanoutmys...@gmail.com> wrote:
>> 
>> Hi David
>> 
>> Did you remember to set your alphavantage key as an environment variable 
>> when testing with Perl from the command line?
>> 
>> Can you try this:
>> 
>> C:\Program Files (x86)\gnucash\bin>set 
>> ALPHAVANTAGE_API_KEY=__Your_Actual_Key__
>> 
>> C:\Program Files (x86)\gnucash\bin>echo %ALPHAVANTAGE_API_KEY%
>> __Your_Actual_Key__
>> 
>> C:\Program Files (x86)\gnucash\bin>echo (currency "USD" "GBP") | perl 
>> gnc-fq-helper
>> (("USD" (symbol . "USD") (gnc:time-no-zone . "2021-03-10 08:40:01") (last . 
>> #e0.72002) (currency . "GBP")))
>> 
>> C:\Program Files (x86)\gnucash\bin>echo (currency "EUR" "RON") | perl 
>> gnc-fq-helper
>> (("EUR" (symbol . "EUR") (gnc:time-no-zone . "2021-03-10 08:45:05") (last . 
>> #e4.8841) (currency . "RON")))
>> 
>> 
>> Also, it is normal to get the blank command window when doing Get Quotes on 
>> Windows.
>> 
>> Regards
>> 
>> Geoff
>> =====
>> 
>>> On 18/07/2021 8:04 pm, david.rom...@davidjromano.com wrote:
>>> I'm having a problem with GNC-FQ not being able to retrieve currency data
>>> for the GBP / EUR currency pair.
>>> I had previously used FQ back when the data source was Yahoo, but when the
>>> Yahoo died I stopped using it.
>>> I now need to pick up GBP and EUR rates so I've installed the components
>>> required to get the Alphavantage feed to work - or so I hoped!
>>> Here's where I've got to so far:
>>> 1.    I updated GNU Cash to current 4.6.
>>> 2.    I installed Strawberry Perl version 5.32.1.1
>>> 3.    I'm Running Windows 10 Professional 21H1 build 19043.110
>>> 4.    I added my aphhavantage key in Preferences \ Online Quotes
>>> 5.    I ran perl gnc-fq-check and got the following result:
>>> C:\Program Files (x86)\gnucash\bin>perl gnc-fq-check
>>> ("1.51" "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" "ftfunds"
>>> "fundata" "fundlibrary" "goldmoney" "greece" "hu" "hufund" "hungary"
>>> "hustock" "iexcloud" "india" "indiamutual" "known_currencies"
>>> "morningstarau" "morningstarjp" "mstaruk" "nasdaq" "nseindia" "nyse" "nzx"
>>> "onvista" "oslobors" "romania" "seb_funds" "six" "tiaacref" "tmx"
>>> "tradeville" "troweprice" "troweprice_direct" "tsp" "ukfunds" "unionfunds"
>>> "usa" "usfedbonds" "yahoo_json" "za")
>>> 6.    I ran perl gnc-fq-update and got the following result:
>>> C:\Program Files (x86)\gnucash\bin>perl gnc-fq-update
>>> Database was generated on Sat, 17 Jul 2021 11:42:13 GMT
>>> Date::Manip is up to date (6.85).
>>> Finance::Quote is up to date (1.51).
>>> 7.    I tested the alphavantage data feed using this URL string and got
>>> the following result:
>>> https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_curre
>>> ncy=GBP&to_currency=EUR&apikey=[MYKEY}
>>> Realtime Currency Exchange Rate
>>> 1. From_Currency Code       "GBP"
>>> 2. From_Currency Name      "British Pound Sterling"
>>> 3. To_Currency Code  "EUR"
>>> 4. To_Currency Name "Euro"
>>> 5. Exchange Rate       "1.16550000"
>>> 6. Last Refreshed       "2021-07-18 09:00:04"
>>> 7. Time Zone    "UTC"
>>> 8. Bid Price       "1.16544000"
>>> 9. Ask Price       "1.16555000"
>>> All looked good so I set the two currencies GBP and EUR to get online quotes
>>> in the Security Editor.
>>> I then switched to the Price Database and clicked Get Quotes only to get the
>>> following failure message:
>>>   Interestingly, when I click the Get Quotes button (and when I open GNU 
>>> Cash)
>>> Perl pops a blank CMD window  (C:Strawbery\perl\bin\perl.exe) and the window
>>> closes without being populated.
>>> I then created a new alphavantage key which I updated in GNC preferences,
>>> but I got the same result when I ran Get Quotes.
>>> I next tried the following code example:
>>> cd \Program Files (x86)\gnucash\bin
>>> set ALPHAVANTAGE_API_KEY=[MYKEY]
>>> perl gnc-fq-dump alphavantage CSCO
>>> Which generated the following output:
>>> C:\Program Files (x86)\gnucash\bin>perl gnc-fq-dump alphavantage EUR
>>> syswrite() on unopened filehandle GEN0 at
>>> C:/Strawberry/perl/lib/IO/Handle.pm line 459.
>>> Finance::Quote fields Gnucash uses:
>>>    symbol: EUR (deduced)        <=== required
>>>    date: ** missing **        <=== recommended
>>>   currency: ** missing **        <=== required
>>>    last: **missing**          <=\
>>>    nav: **missing**          <=== one of these
>>>    price: **missing**          <=/
>>>   timezone:                      <=== optional
>>> My immediate thought was that either GNC or PERL were being blocked by Win
>>> 10 security so I explicitly added both Perl Interpreter and GNC to the apps
>>> allowed through Windows Firewall - both private and public. This made no
>>> difference.
>>> I then wondered if the problem was IP blocking so tried again over a VPN,
>>> thus a different IP. This made no difference.
>>> I'm not a Perl programmer so I'm now pretty much stuck. Possibly I've missed
>>> something very obvious or else there is something strange going on here
>>> which I don't understand.
>>> If anyone can suggest how to diagnose the issue from here, or better still
>>> fix the issue, I'd very much appreciate the help.
>>> _______________________________________________
>>> gnucash-user mailing list
>>> gnucash-user@gnucash.org
>>> To update your subscription preferences or to unsubscribe:
>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>> If you are using Nabble or Gmane, please see 
>>> https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
>>> -----
>>> Please remember to CC this list on all your replies.
>>> You can do this by using Reply-To-List or Reply-All.
> 
> _______________________________________________
> gnucash-user mailing list
> gnucash-user@gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see 
> https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see 
https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to