[GNC] ASX quotes not working

John Bonnett jbonnett at internode.on.net
Sat Oct 17 00:31:13 EDT 2020


Hi Geoff,

Thanks for all your effort too, the least I can do is try to help you 
with good feedback. Incidentally I am a recently retired software 
developer so, even though I had never worked with Perl, I was pretty 
sure I knew what you needed to know.

I can report that, with your new ASX.pm, everything works, inside and 
outside GnuCash. All my ASX stocks retrieve and also one from NASDAQ.

Thanks again for your help,
John Bonnett

On 17/10/2020 2:10 pm, Geoff wrote:
> Hi John
>
> Thanks for your patience and detailed feedback, it has been very helpful.
>
> Firstly, I installed strawberry-perl-5.18.2.2-32bit and was able to 
> reproduce the original error you reported on line 138.  This was due 
> to sloppy coding on my part.  Later versions of perl are more 
> forgiving, however that line should in fact be:
>
> $info{$stock,$label} = $decoded_json->{$label_map{$label}};
>
> (The explanation being that $decoded_json is a *reference* to a hash, 
> and the correct way to dereference it and access its values is with 
> the "->" notation, not "%$".)
>
>
> Secondly, the error you encountered with stock "14D" (in your email 
> below) is not due to the stock code starting with a number, but a lack 
> of defensive coding on my part.  For this stock, the ASX did not 
> return the "year_range" data element, and the message you saw (which 
> is only a warning) says that the element has an undefined value.  I 
> have attached an updated version of ASX.pm with a fix for this:
>
> C:\Program Files (x86)\gnucash\bin>perl gnc-fq-dump asx 14d
> Finance::Quote fields Gnucash uses:
>     symbol: 14d                  <=== required
>       date: 10/16/2020           <=== recommended
>   currency: AUD                  <=== required
>       last: 0.135                <=\
>        nav:                      <=== one of these
>      price: 0.135                <=/
>   timezone:                      <=== optional
>
>
> Thirdly, I can successfully retrieve prices in GnuCash itself - see 
> attached screenshot.  If you don't mind, can you review your 
> configuration against that, and try again with the updated ASX.pm module?
>
>
> Fourthly, the Finance::Quote developers have contacted me and I hope 
> to be able to submit this as a fix that will go into the distribution. 
> After some more rigourous testing obviously!
>
>
> Regards
>
> Geoff
> =====
>
>
>
> On 16/10/2020 3:29 pm, John Bonnett wrote:
>> Hi Geoff,
>>
>> I am still not getting all my stocks retrieved inside GnuCash but I 
>> may have made some progress.
>>
>> I checked the stocks not working using gnc-fq-dump and they all 
>> retrieved except for one I still had that had been de-listed, so that 
>> is as expected, but does not explain why they don't work inside GnuCash.
>>
>> I retrieved them all in one call to gnc-fq-dump and I noticed there 
>> was an error message at the start. After a little more digging I 
>> found just one stock was causing that problem as follows:
>>
>> PS C:\Program Files (x86)\gnucash\bin> perl gnc-fq-dump ASX 14D
>> Use of uninitialized value in transliteration (tr///) at 
>> C:/strawberry/perl/site/lib/Finance/Quote/ASX.pm line 141.
>> Finance::Quote fields Gnucash uses:
>>      symbol: 14D                  <=== required
>>        date: 10/16/2020           <=== recommended
>>    currency: AUD                  <=== required
>>        last: 0.145                <=\
>>         nav:                      <=== one of these
>>       price: 0.145                <=/
>>    timezone:                      <=== optional
>> PS C:\Program Files (x86)\gnucash\bin>
>>
>> It may be that having a stock symbol starting with a number is 
>> causing the problem, but it still retrieves OK. It did occur to me 
>> that, depending on the order that GnuCash does the retrieving 
>> internally, that error may make the program think there are no valid 
>> values after that message and explain why some of the stocks are 
>> missing in the results.
>>
>> Best regards,
>> John Bonnett
>>
>> On 16/10/2020 9:05 am, John Bonnett wrote:
>>> Hi Geoff,
>>>
>>> I seem to have partly solved my problem. Following up on a comment 
>>> from Bill and your interest in the version of Perl I was running, I 
>>> chased up a recent version of Strawberry Perl.
>>>
>>> I got v5.32.0 64bit and installed that. It still thought I had the 
>>> older 32bit installed so I tried uninstalling that. This broke the 
>>> 64bit install, so I repaired it and then ran the "Install Online 
>>> Price Retrieval for GnuCash" option on the Windows GnuCash menu. 
>>> This got the standard installation back. I then followed your 
>>> original instructions about replacing ASX.pm and ran your check as 
>>> follows:
>>>
>>> PS C:\WINDOWS\system32> cd "C:\Program Files (x86)\gnucash\bin"
>>> PS C:\Program Files (x86)\gnucash\bin> perl gnc-fq-dump ASX BHP
>>> Finance::Quote fields Gnucash uses:
>>>     symbol: BHP                  <=== required
>>>       date: 10/15/2020           <=== recommended
>>>   currency: AUD                  <=== required
>>>       last: 36.77                <=\
>>>        nav:                      <=== one of these
>>>      price: 36.77                <=/
>>>   timezone:                      <=== optional
>>> PS C:\Program Files (x86)\gnucash\bin>
>>>
>>> I then tried running "Get Quotes" from inside GnuCash and it seems 
>>> to have partly worked. Some of my ASX stocks are still not 
>>> retrieving but others are. I will investigate using gnc-fq-dump and 
>>> report back.
>>>
>>> Thanks for your help,
>>>
>>> John Bonnett
>>>
>>



More information about the gnucash-user mailing list