Hi again David

Here is an easy way to determine if Perl and Finance::Quote are working correctly, independently of GnuCash itself.

Set your Alphavantage key as before, and type in this one liner:

perl -MFinance::Quote -e "my $q = Finance::Quote->new(); print $q->currency(q/USD/,q/GBP/);"


Expected result:

0.72953


[Note to other readers - the above is the syntax for Windows]

See attached screenshot.

Hope this helps.

Regards

Geoff
=====

On 19/07/2021 9:04 pm, david.rom...@davidjromano.com wrote:
Good Morning Chris,

Many thanks for this, which I've just worked through with the results as
below - I've also worked through Geoff's suggestions.

The results are not encouraging though!

You are right that I'm running FC 1.51

        C:\Program Files (x86)\gnucash\bin>perl gnc-fq-update
                Database was generated on Mon, 19 Jul 2021 09:43:47 GMT
                Date::Manip is up to date (6.85).
                Finance::Quote is up to date (1.51).

        C:\>perl -v

                This is perl 5, version 32, subversion 1 (v5.32.1) built for
MSWin32-x86-multi-thread-64int (I think this is the latest version.)

1.   cpan upgrade DONE

        cpan> upgrade
                
                Database was generated on Mon, 19 Jul 2021 09:43:47 GMT

        C:\>cpan -v
                        Loading internal logger. Log::Log4perl recommended
for better logging
                        >(info): C:\Strawberry\perl\bin/cpan script version
1.676, CPAN.pm version 2.28

2. gnc-fq-dump

After setting the alphavantage key (and confirming with echo) this fails as
follows:

        C:\Program Files (x86)\gnucash\bin>perl gnc-fq-dump currency USD EUR

                > RETURNS ERROR STRING:

                        syswrite() on unopened filehandle GEN0 at
C:/Strawberry/perl/lib/IO/Handle.pm line 459.
                        syswrite() on unopened filehandle GEN1 at
C:/Strawberry/perl/lib/IO/Handle.pm line 459.
                        1 USD = <unknown> EUR

However, gnc-fq is still not working so maybe it's an issue with FC 1.51 or
maybe I have some issue with Perl that I don't understand.

-----Original Message-----
From: Chris Good <goodchri...@gmail.com>
Sent: 19 July 2021 01:48
To: gnucash-user@gnucash.org
Cc: david.rom...@davidjromano.com
Subject: RE: [GNC] Can anyone help with this issue please - GNC-FQ Not able
to collect data

Hi David,

 From memory Finance::Quote 1.51 is broken and the nice maintainer is working
on 1.52.
The problems were to do with missing dependencies for some cpan modules.
In the meantime you might try, from a cmd.exe window:
   cpan upgrade
to upgrades all modules.

Note that the correct syntax to use gnc-fq-dump to get an exchange rate is:
cd C:\Program Files (x86)\gnucash\bin
set ALPHAVANTAGE_API_KEY=__Your_Actual_Key__
perl gnc-fq-dump currency USD EUR

See https://wiki.gnucash.org/wiki/Online_Quotes#Helper_Scripts

Another thing to check is your version of Strawberry perl. Use  perl -v to
check the version.
Maybe you need to upgrade to the latest Strawberry perl.
You can uninstall your current Strawberry perl from Start, Settings, Apps.

Regards, Chris Good

Message: 2
Date: Sun, 18 Jul 2021 15:30:43 +0100
From: "david.rom...@davidjromano.com" <david.rom...@davidjromano.com>
To: Geoff <cleanoutmys...@gmail.com>
Cc: gnucash-user@gnucash.org
Subject: Re: [GNC] Can anyone help with this issue please - GNC-FQ Not
        able to collect data
Message-ID: <12969517-6727-42c5-a202-04b3b75f8...@davidjromano.com>
Content-Type: text/plain;       charset=us-ascii

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&fro
m_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.

Reply via email to