This module gets stock quotes from Yahoo! Finance. The <B>getonequoteB>
function will return a quote for a single stock symbol, while the
<B>getquoteB> function will return a quote for each of the stock symbols
passed to it. <B>getcustomquoteB> allows to specify a format other than
the default to take advantage of the extended range of available information.
The download operation is efficient: only one request is made even if
several symbols are requested at once. The return value of
<B>getonequoteB> is an array, with the following elements:
1 Company Name
2 Last Price
3 Last Trade Date
4 Last Trade Time
6 Percent Change
8 Average Daily Vol
11 Previous Close
12 Todays Open
13 Days Range
14 52-Week Range
15 Earnings per Share
16 P/E Ratio
17 Dividend Pay Date
18 Dividend per Share
19 Dividend Yield
20 Market Capitalization
21 Stock Exchange
If the extended format has been selected, the following fields are also
22 Short ratio
23 1yr Target Price
24 EPS Est. Current Yr
25 EPS Est. Next Year
26 EPS Est. Next Quarter
27 Price/EPS Est. Current Yr
28 Price/EPS Est. Next Yr
29 PEG Ratio
30 Book Value
34 50-day Moving Avg
35 200-day Moving Avg
If the real-time format has been selected, the following fields are also
36 Ask (real-time)
37 Bid (real-time)
38 Change in Percent (real-time)
39 Last trade with time (real-time)
40 Change (real-time)
41 Day range (real-time)
42 Market-cap (real-time)
The <B>getquoteB> function returns an array of pointers to arrays with
the above structure.
The <B>getonequoteB> function returns just one quote, rather than an array. It returns a simple array of values for the given symbol.
The <B>setQueryStringB> permits to supply a new query string that will
be used for subsequent data requests.
The <B>useExtendedQueryFormatB> and <B>useRealtimeQueryFormatB> are
simpler interfaces which append symbols to the default quote string,
as detailed above.
The <B>getcustomquoteB> returns an array of quotes corresponding to
values for the symbols supplied in the first array reference, and the
custom fields supplied in the second array reference. Here the custom
fields correspond to the named fields of the list below.
Beyond stock quotes, <B>Finance::YahooQuoteB> can also obtain quotes for
currencies (from the Philadephia exchange however Yahoo! appears to
have stopped to support the currency symbols in a reliable manner), US
mutual funds, options on US stocks, several precious metals and quite
possibly more; see the Yahoo! Finance website for full
information. <B>Finance::YahooQuoteB> can be used for stocks from the
USA, Canada, various European exchanges, various Asian exchanges
(Singapore, Taiwan, HongKong, Kuala Lumpur, ...) Australia and New
Zealand. It should work for other markets supported by Yahoo.
You may optionally override the default LWP timeout of 180 seconds by setting
$Finance::YahooQuote::TIMEOUT to your preferred value.
You may also provide a proxy (for the required http connection) by using
the variable $Finance::YahooQuote::PROXY. Furthermore, authentication-based
proxies can be used by setting the proxy user and password via the variables
$Finance::YahooQuote::PROXYUSER and $Finance::YahooQuote::PROXYPASSWD.
Two example scripts are provided to help with the mapping a stock
symbols as well as with Yahoo! Finance server codes. The regression
tests scripts in the <B>t/B> subdirectory of the source distribution
also contain simple examples.