Stock price fetch from ASX broken?
Chris Good
chris.good at ozemail.com.au
Wed May 10 18:11:59 EDT 2017
> Message: 1
> Date: Sat, 06 May 2017 22:16:34 +1000
> From: Chris Good <chris.good at ozemail.com.au>
> To: GnuCash User Mailing List <gnucash-user at gnucash.org>
> Cc: GnuCash Developers <gnucash-devel at gnucash.org>
> Subject: Re: Stock price fetch from ASX broken?
> Message-ID: <1acb8b1b-e4ac-4224-89fd-
> 2dba02703bee at email.android.com>
> Content-Type: text/plain; charset="utf-8"
>
> Message: 4
> Date: Sat, 6 May 2017 11:59:21 +1000
> From: prl <prl at ozemail.com.au>
> To: "gnucash-user at gnucash.org" <gnucash-user at gnucash.org>
> Subject: Stock price fetch from ASX broken?
> Message-ID: <06109c86-16d5-ff6a-1c3f-88d717141423 at ozemail.com.au>
> Content-Type: text/plain; charset=utf-8; format=flowed
> For the past two weeks, I haven't been able to fetch stock prices
> from
> the Australian Stock Exchange, AU (ASX) source in GnuCash.
> It looks like the ASX has changed something on their Web page that
> breaks the Finance::Quote screen scraper for ASX:
> Cambyses:bin prl$ ./gnc-fq-dump -v asx TLS
> Finance::Quote fields Gnucash uses:
> symbol: TLS (deduced) <=== required
> date: ** missing ** <=== recommended
> currency: ** missing ** <=== required
> last: <=\
> nav: <=== one of these
> price: <=/
> timezone: <=== optional
> ** This stock quote cannot be used by GnuCash!
> All fields returned by Finance::Quote for stock TLS
> stock field value
> ----- ----- -----
> TLS errormsg: Failed to parse HTML table.<<<<<< Here
> TLS last: **missing**
> TLS nav: **missing**
> TLS price: **missing**
> TLS success: 0
> Cambyses:bin prl$
> Using the yahoo_australia source for the same stock code works:
> Cambyses:bin prl$ ./gnc-fq-dump yahoo_australia TLS
> Finance::Quote fields Gnucash uses:
> symbol: TLS.AX <=== required
> date: 05/05/2017 <=== recommended
> currency: AUD <=== required
> last: 4.40 <=\
> nav: <=== one of these
> price: 4.40 <=/
> timezone: <=== optional
> Cambyses:bin prl$
> I guess this is something I need to talk to the Finance::Quote
> maintainer about?
> Cheers,
> Peter
>
> Hi Peter,
> This was reported recently as starting around 21 April. I'm no web
> expert but I've had a look and it seems to me the web page used no
> longer works unless the browser supports javascript. I've found an
> alternate web page (m.asx.com.au for mobile devices) that doesn't seem
> to have this restriction and works from the perl library used so long
> as cookies are also turned on. Unfortunately, I cannot find a way for
> it to request quotes for multiple stocks at once, so the fix I'm
> working on maybe slower than it was. Also, it doesn't include all the
> info that it previously did, but it does have enough for GnuCash. I
> hope to have a fix available in a couple of days.
> There is another m.asx.com.au page that does contain all the previous
> info but also needs javascript. If anyone can find a way to bypass the
> javascript problem, I'd like to hear it. I've tried setting UserAgent
> to pretend to be various versions of IE.
> I haven't supplied the exact urls now as I'm not at my computer. If
> anyone can help, please let me know.
> Also, Eric Colson (the Finance::Quote maintainer as far as I know)
> seems to be incommunicado, so I can only supply a fix file to be
> manually installed, not get my fix incorporated into F::Q.
> Thankfully yahoo_australia is an alternative but it's good to have a
> working backup source for aussie quotes.
> Regards, Chris Good
There is now a fix for this problem available, but it is not yet included in
the official Finance::Quote module available from CPAN.
If you'd like to manually install the fix now, it is available on github:
Enter
https://github.com/goodvibes2/finance-quote/blob/iss46FqASX/lib/Finance/Quot
e/ASX.pm
in a browser, click on the Raw button which should open the contents of the
new ASX.pm file on a new page.
Use Control-A to highlight it all, then paste it into a text editor
(say Notepad for Windows, gedit for Linux), then
'Save As' over the top of the existing ASX.pm:
Windows (Strawberry Perl):
C:\strawberry\perl\site\lib\Finance\Quote\ASX.pm
Linux
/usr/local/share/perl/5.22.1/Finance/Quote/ASX.pm
Sorry, I don't have a Mac so I cannot provide instructions, but I guess you
just find ASX.pm and replace it with the new version from the above github
link.
I've noticed that both the old & new url's do not work for indices (eg XAO
Australian Ordinaries) even in IE11, but the comments in ASX.pm lead me to
believe that they once did. Can anyone shed any light on this?
I suppose they wouldn't be useful in GnuCash as there is no currency
returned by ASX.pm anyway, which GC requires.
If anyone is interested, I think I could modify ASX.pm to return indices
info as this is available from http://m.asx.com.au/m/prices/indices.xhtml
Is anyone interested?
Regards, Chris Good
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6508 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20170511/c54e53cc/attachment-0001.p7s>
More information about the gnucash-user
mailing list