[GNC] Difficulty with online price retrieval

John Ralls jralls at ceridwen.us
Thu Aug 6 19:56:44 EDT 2020


Samantha,

I'd prefer to keep everything on the list. I'm not regularly a Windows user and someone who is might be able to chime in with more help.

I think you have a CMD shell there rather than a Powershell. Powershell would color $Env:ALPHAVANTAGE_API_KEY bright green no matter what else you typed and it puts a space between the prompt and your input. CMD doesn't color anything and doesn't separate the prompt from the input with a space. To set an environment variable in CMD you do
  SET ALPHAVANTAGE_API_KEY <your key>
making the obvious substitution. No quotes are needed, and the angle braces are part of the substitution.

Regards,
John Ralls

> On Aug 5, 2020, at 2:17 AM, Samantha Payn <samantha at boorertranslations.com> wrote:
> 
> Hi John 
> Sorry for my lengthy silence. I have attempted to follow your instructions but so far without success. 
> This is as far as I have got: 
> C:\Program Files (x86)\gnucash\bin>$Env:ALPHAVANTAGE_API_KEY = "[my alphavantage key" 
> The filename, directory name, or volume label syntax is incorrect.
> All text in white. 
> If you are willing to help me further, John, perhaps we should take this off the mailing list as at the moment the problems are with my inexperience in the Powershell environment, rather than with gnucash itself? 
> Many thanks for your assistance so far and hoping for your continued patience. 
> Samantha 
>> On 27 July 2020 20:16 John Ralls < jralls at ceridwen.us> wrote:
>> 
>> 
>> Samantha,
>> 
>> Regardless of the shell you must enclose paths with spaces in quotes, e.g.
>> cd "c:\Program Files (86)\gnucash\bin"
>> You can use ' instead of " if you like. You can also start typing and use tab completion, for example type
>> cd c:\prog<TAB>
>> and the shell will change it to
>> cd 'C:\Program Files\'
>> You can then backspace out the \', type a space and <TAB> again and it will fill in the (x86)\' for you.
>> 
>> Regards,
>> John Ralls
>> 
>> 
>>> On Jul 27, 2020, at 12:01 PM, Samantha Payn < samantha at boorertranslations.com> wrote:
>>> 
>>> Sorry John (and everyone). I can't get it to accept (x86) now:
>>> 
>>> C:\Users\User> cd C:\Program Files (x86)\gnucash\bin
>>> x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program.
>>> Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
>>> At line:1 char:22
>>> + cd C:\Program Files (x86)\gnucash\bin
>>> + ~~~
>>> + CategoryInfo : ObjectNotFound: (x86:String) [], CommandNotFoundException
>>> + FullyQualifiedErrorId : CommandNotFoundException
>>> 
>>> So sorry. Instead of bothering you guys should I try to get local help?
>>> Best wishes and thanks again
>>> Samantha
>>>> On 27 July 2020 19:30 John Ralls < jralls at ceridwen.us> wrote:
>>>> 
>>>> 
>>>> Samantha,
>>>> 
>>>> Sorry I wasn't more explicit: Yes, each command is a line on its own, followed by <Return>. You need to use quotes around your API key, so
>>>> $Env:ALPHAVANTAGE_API_KEY = "[my API key]"
>>>> 
>>>> I see that I left off the second quote in the perl command line, it should be
>>>> perl 'c:\Program Files (x86)\gnucash\bin\gnc-fq-dump currency' USD GBP
>>>> 
>>>> The Powershell terminal color-codes errors in red on black, variables and special values (e.g. $true, $false) in green, and command names in yellow.
>>>> 
>>>> Regards,
>>>> John Ralls
>>>> 
>>>>> On Jul 27, 2020, at 2:30 AM, Samantha Payn < samantha at boorertranslations.com> wrote:
>>>>> 
>>>>> Hi John
>>>>> I am sorry to have to come back to you for more support on this and thanks again for your patience.
>>>>> After some fumbling (am I right that I should type each line you have typed followed by the "Enter" key? I really am that much of a newb at this), I got an error message in red type as follows:
>>>>> [my API key] : The term '[my API key]' is not recognized as the name of a cmdlet, function,
>>>>> script file, or operable program. Check the spelling of the name, or if a path was included, verify
>>>>> that the path is correct and try again.
>>>>> At line:1 char:29
>>>>> + $Env:ALPHAVANTAGE_API_KEY = [my API key]
>>>>> + ~~~~~~~~~~~~~~~
>>>>> + CategoryInfo : ObjectNotFound: ([my API key]:String) [], CommandNotFoundException
>>>>> + FullyQualifiedErrorId : CommandNotFoundException
>>>>> 
>>>>> (In the text above I have switched out my 16 digit API key for the words "[my API key]").
>>>>> 
>>>>> Please also explain what the significance of green and yellow text is in this environment.
>>>>> Many thanks
>>>>> Samantha
>>>>> 
>>>>> 
>>>>>> On 25 July 2020 20:04 John Ralls < jralls at ceridwen.us> wrote:
>>>>>> 
>>>>>> 
>>>>>> Samantha,
>>>>>> 
>>>>>> Powershell (Admin) just means Powershell with admin privilege. Starting it will raise a User Authorization Escalation dialog box asking if you're sure that you want Powershell to "make changes to your device". You don't need it for this test, plain Powershell is fine. Yes, Powershell. I don't think that there is a Poweshell, please excuse my hasty typing.
>>>>>> 
>>>>>> Since you use only those 3 currencies try all three combinations, i.e. USD->GBP, EUR->GBP, and EUR->USD with gnc-fq-dump.
>>>>>> 
>>>>>> Regards,
>>>>>> John Ralls
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Jul 25, 2020, at 10:27 AM, Samantha Payn < samantha at boorertranslations.com> wrote:
>>>>>>> 
>>>>>>> John, thank you for your continued support.
>>>>>>> Before I try this can I just clarify two points:
>>>>>>> I have a choice of Windows Powershell and Windows Powershell (Admin): which should I choose?
>>>>>>> And in the middle of your email I presume you mean "Powershell" (not Poweshell as typed)?
>>>>>>> Finally, in response to your question I have no securities in my Gnucash accounts. I am a freelance translator with a home currency of GBP and clients who pay me (and a very occasional purchase) in EUR and USD and use Gnucash for my business accounts. These are the currency rates I am trying to access.
>>>>>>> Best wishes
>>>>>>> Samantha
>>>>>>>> On 25 July 2020 17:12 John Ralls < jralls at ceridwen.us> wrote:
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Samantha,
>>>>>>>> 
>>>>>>>> Next, some command-line testing. You can use CMD if you like, but I find Powershell to be a bit friendlier and easier to get to: Just right-click in the Start menu and it's in the middle. Once you have a shell, cd to C:\Program Files (x86)\gnucash\bin.
>>>>>>>> 
>>>>>>>> First you'll need to set your ALPHAVANTAGE_API_KEY in the environment:
>>>>>>>> CMD
>>>>>>>> set ALPHAVANTAGE_API_KEY xxx...
>>>>>>>> Poweshell
>>>>>>>> $Env:ALPHAVANTAGE_API_KEY = xxx...
>>>>>>>> 
>>>>>>>> Now test that you can retrieve an arbitrary currency pair:
>>>>>>>> perl 'c:\Program Files (x86)\gnucash\bin\gnc-fq-dump currency USD GBP
>>>>>>>> 
>>>>>>>> If that works then Finance::Quote is working correctly and something else is going on. So far you've mentioned only currency rates, but the usual reason for a system error message from online price retrieval is trying to get a stock price from one of the dicontinued Yahoo! price sources. Do you have any securities in your book? If you're unsure use Tools>Security Editor to show a list of them.
>>>>>>>> 
>>>>>>>> Regards,
>>>>>>>> John Ralls
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> On Jul 25, 2020, at 5:22 AM, Samantha Payn < samantha at boorertranslations.com> wrote:
>>>>>>>>> 
>>>>>>>>> Thank you for your help John.
>>>>>>>>> I have done as you instruct (including restarting Gnucash after the install) but there is now a different problem.
>>>>>>>>> The Gnucash about info now does show version 1.49 for Finance::Quote
>>>>>>>>> The Get Quotes button does light up, but when I click it I get an error window that says: "There was a system error while retrieving the price quotes".
>>>>>>>>> I have tried restarting my computer to see if that helps but it made no difference.
>>>>>>>>> The last two lines of the installing text in the CPAN window, before the cpan prompt reappeared were *slightly* different to what you showed in your email. As far as I can recall they said:
>>>>>>>>> Appending installation info to C:\strawberry\perl\lib/perllocal.pod
>>>>>>>>> ECOCODE/Finance-Quote-1.49.tar.gz
>>>>>>>>> C:\STRAWB\c\bin\gmake.exe install UNINST=1 -- OK
>>>>>>>>> Can you please give me guidance on what to do now?
>>>>>>>>> Very many thanks!
>>>>>>>>> Samantha
>>>>>>>>> 
>>>>>>>>>> On 24 July 2020 21:12 John Ralls < jralls at ceridwen.us> wrote:
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> On Jul 24, 2020, at 4:33 AM, Samantha Payn < samantha at boorertranslations.com> wrote:
>>>>>>>>>>> 
>>>>>>>>>>> Sorry to repeat myself but can anyone help me or shall I have to rely
>>>>>>>>>>> on manual input of foreign exchange rates for the foreseeable future? I
>>>>>>>>>>> think that Windows has put the online price retrieval somewhere where
>>>>>>>>>>> Gnucash cannot "see" it and I am not sufficiently computer literate to
>>>>>>>>>>> correct this.
>>>>>>>>>>> My problem is that when I go to post an invoice in a "foreign" currency
>>>>>>>>>>> the "fetch rate" button is greyed out so I cannot use the online
>>>>>>>>>>> currency rate retrieval that I used to be able to before I upgraded my
>>>>>>>>>>> hardware.
>>>>>>>>>>> After installing the current version of gnucash on my new PC, I clicked
>>>>>>>>>>> on "Install Online Price Retrieval" from the Gnucash list in my start
>>>>>>>>>>> menu and I have entered the Alfa Vantage API key in my gnucash
>>>>>>>>>>> preferences.
>>>>>>>>>>> I have checked for the presence of the perl software using the
>>>>>>>>>>> Troubleshooting method John Ralls directed me to and received the
>>>>>>>>>>> response that I should install the Finance::Quote. The only way I have
>>>>>>>>>>> done this in the past is by clicking on "Install Online Price
>>>>>>>>>>> Retrieval" from the Gnucash list in my start menu and this is what I
>>>>>>>>>>> have done. So I have done this again and after a run of code in the cmd
>>>>>>>>>>> window the final lines are:
>>>>>>>>>>> "C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e cp - -
>>>>>>>>>>> examples/dm_zdump blib\script\dm_zdump pl2bat.bat blib\script\dm_dump
>>>>>>>>>>> SBECK/Date-Manip-6.82.tar.gz
>>>>>>>>>>> C:\STRAWB~1\c\bin\gmake.exe - -OK
>>>>>>>>>>> Does this mean that online price retrieval has been installed?
>>>>>>>>>>> When I look in the Windows list of apps installed it says I have
>>>>>>>>>>> installed Strawberry Perl on 3rd July (when I first tried installing it
>>>>>>>>>>> on my new PC).
>>>>>>>>>>> I am running the latest version of Gnucash and I find that in the help
>>>>>>>>>>> window it says
>>>>>>>>>>> "Version: 4.0
>>>>>>>>>>> Build ID: 4.0+(2020-06-27)
>>>>>>>>>>> Finance::Quote: -"
>>>>>>>>>>> Please let me know what other information you need in order to be able
>>>>>>>>>>> to help me. I am stepping way out of my comfort zone when I enter the
>>>>>>>>>>> cmd window but willing to give it a go.
>>>>>>>>>> It looks like Finance::Quote is not getting installed. Try this:
>>>>>>>>>> 
>>>>>>>>>> Find the Strawberry Perl group in the Start menu (windows logo at the bottom left of the screen). Open it and start CPAN Client. You'll get something that looks sort of like a CMD window. At the prompt there type
>>>>>>>>>> install Finance::Quote
>>>>>>>>>> It will probably take a while and should eventually finish with
>>>>>>>>>> Appending installation info to C:\strawberry\perl\lib/perllocal.pod
>>>>>>>>>> ECOCODE/Finance-Quote-1.49.tar.gz
>>>>>>>>>> C:\strawberry\c\bin\dmake.exe install UNINST=1 -- OK
>>>>>>>>>> 
>>>>>>>>>> If GnuCash is running restart it, after which it should report version 1.49 for Finance::Quote and light up the Get Quotes button.
>>>>>>>>>> 
>>>>>>>>>> Regards,
>>>>>>>>>> John Ralls



More information about the gnucash-user mailing list