Subject: | Can only get prices for 10 stocks at once from ASX |
Date: | Sun, 23 Feb 2014 15:03:59 +1100 |
To: | <bug-Finance-Quote [...] rt.cpan.org> |
From: | "Chris Good" <chris.good [...] ozemail.com.au> |
Hi,
Windows 7 64-bit, Finance::Quote 1.20, ActivePerl v5.16.1
I'm a GnuCash user and GnuCash uses Finance::Quote to get stock prices.
If you have more than 10 Australian stocks, Finance::Quote only retrieves
prices for the first 10.
I'm pretty sure this is because the ASX website only allows 10 prices to be
retrieved at once.
If you plug 11 stocks into the search field on http://www.asx.com.au/ only
the first 10 are returned.
I've modified asx.t (attached) to add tests for getting 10 stocks at once,
and 11 stocks at once.
Here is the output from the new asx.t which shows errors from the 11th stock
(WES):
E:\Dev\Finance-Quote>perl asx.t
1..55
ok 1 - Data returned for call to asx
ok 2 - WES query was successful
ok 3 - Last price for WES was > 0
ok 4 - BHP query was successful
ok 5 - Last price for BHP was > 0
ok 6 - Data returned for call to fetch
ok 7 - BOQ query was successful
ok 8 - Last price for BOQ was > 0
ok 9 - Currency of BOQ is AUD
ok 10 - No percentage sign in p_change value
Parsing of undecoded UTF-8 will give garbage when decoding entities at
E:/Perl64
/site/lib/HTML/TableExtract.pm line 193.
ok 11 - asx call for invalid stock BOG returns failure
ok 12 - Data returned for call to asx
ok 13 - AMP query was successful
ok 14 - Last price for AMP was > 0
ok 15 - ANZ query was successful
ok 16 - Last price for ANZ was > 0
ok 17 - BHP query was successful
ok 18 - Last price for BHP was > 0
ok 19 - BOQ query was successful
ok 20 - Last price for BOQ was > 0
ok 21 - BEN query was successful
ok 22 - Last price for BEN was > 0
ok 23 - CSR query was successful
ok 24 - Last price for CSR was > 0
ok 25 - IAG query was successful
ok 26 - Last price for IAG was > 0
ok 27 - NAB query was successful
ok 28 - Last price for NAB was > 0
ok 29 - TLS query was successful
ok 30 - Last price for TLS was > 0
ok 31 - WBC query was successful
ok 32 - Last price for WBC was > 0
ok 33 - Data returned for call to asx
ok 34 - AMP query was successful
ok 35 - Last price for AMP was > 0
ok 36 - ANZ query was successful
ok 37 - Last price for ANZ was > 0
ok 38 - BHP query was successful
ok 39 - Last price for BHP was > 0
ok 40 - BOQ query was successful
ok 41 - Last price for BOQ was > 0
ok 42 - BEN query was successful
ok 43 - Last price for BEN was > 0
ok 44 - CSR query was successful
ok 45 - Last price for CSR was > 0
ok 46 - IAG query was successful
ok 47 - Last price for IAG was > 0
ok 48 - NAB query was successful
ok 49 - Last price for NAB was > 0
ok 50 - TLS query was successful
ok 51 - Last price for TLS was > 0
ok 52 - WBC query was successful
ok 53 - Last price for WBC was > 0
not ok 54 - WES query was successful
# Failed test 'WES query was successful'
# at asx.t line 144.
Use of uninitialized value $got in numeric gt (>) at (eval in cmp_ok) asx.t
line
145.
not ok 55 - Last price for WES was > 0
# Failed test 'Last price for WES was > 0'
# at asx.t line 145.
Use of uninitialized value $val in addition (+) at
E:/Perl64/lib/Test/Builder.pm
line 917.
# undef
# >
# '0'
# Looks like you failed 2 tests of 55.
I'll see if I can modify ASX.pm to batch them into groups of 10.
Regards, Chris Good
Message body not shown because it is not plain text.