1YahooQuote(3)         User Contributed Perl Documentation        YahooQuote(3)
2
3
4

NAME

6       Finance::YahooQuote - Get stock quotes from Yahoo! Finance
7

SYNOPSIS

9         use Finance::YahooQuote;
10         # setting TIMEOUT and PROXY is optional
11         $Finance::YahooQuote::TIMEOUT = 60;
12         $Finance::YahooQuote::PROXY = "http://some.where.net:8080";
13         @quote = getonequote $symbol; # Get a quote for a single symbol
14         @quotes = getquote @symbols;  # Get quotes for a bunch of symbols
15         useExtendedQueryFormat();     # switch to extended query format
16         useRealtimeQueryFormat();     # switch to real-time query format
17         @quotes = getquote @symbols;  # Get quotes for a bunch of symbols
18         @quotes = getcustomquote(["DELL","IBM"], # using custom format
19                                  ["Name","Book Value"]); # note array refs
20

DESCRIPTION

22       NOTE: As of November 2017, the module is no longer all that useful as
23       Yahoo! decided to halt the API service it relies on.
24
25       This module gets stock quotes from Yahoo! Finance.  The getonequote
26       function will return a quote for a single stock symbol, while the
27       getquote function will return a quote for each of the stock symbols
28       passed to it.  getcustomquote allows to specify a format other than the
29       default to take advantage of the extended range of available
30       information.
31
32       The download operation is efficient: only one request is made even if
33       several symbols are requested at once. The return value of getonequote
34       is an array, with the following elements:
35
36           0 Symbol
37           1 Company Name
38           2 Last Price
39           3 Last Trade Date
40           4 Last Trade Time
41           5 Change
42           6 Percent Change
43           7 Volume
44           8 Average Daily Vol
45           9 Bid
46           10 Ask
47           11 Previous Close
48           12 Today's Open
49           13 Day's Range
50           14 52-Week Range
51           15 Earnings per Share
52           16 P/E Ratio
53           17 Dividend Pay Date
54           18 Dividend per Share
55           19 Dividend Yield
56           20 Market Capitalization
57           21 Stock Exchange
58
59       If the extended format has been selected, the following fields are also
60       retrieved:
61
62           22 Short ratio
63           23 1yr Target Price
64           24 EPS Est. Current Yr
65           25 EPS Est. Next Year
66           26 EPS Est. Next Quarter
67           27 Price/EPS Est. Current Yr
68           28 Price/EPS Est. Next Yr
69           29 PEG Ratio
70           30 Book Value
71           31 Price/Book
72           32 Price/Sales
73           33 EBITDA
74           34 50-day Moving Avg
75           35 200-day Moving Avg
76
77       If the real-time format has been selected, the following fields are
78       also retrieved:
79
80           36 Ask (real-time)
81           37 Bid (real-time)
82           38 Change in Percent (real-time)
83           39 Last trade with time (real-time)
84           40 Change (real-time)
85           41 Day range (real-time)
86           42 Market-cap (real-time)
87
88       The getquote function returns an array of pointers to arrays with the
89       above structure.
90
91       The getonequote function returns just one quote, rather than an array.
92       It returns a simple array of values for the given symbol.
93
94       The setQueryString permits to supply a new query string that will be
95       used for subsequent data requests.
96
97       The useExtendedQueryFormat and useRealtimeQueryFormat are simpler
98       interfaces which append symbols to the default quote string, as
99       detailed above.
100
101       The getcustomquote returns an array of quotes corresponding to values
102       for the symbols supplied in the first array reference, and the custom
103       fields supplied in the second array reference. Here the custom fields
104       correspond to the 'named' fields of the list below.
105
106       Beyond stock quotes, Finance::YahooQuote can also obtain quotes for
107       currencies (from the Philadephia exchange -- however Yahoo! appears to
108       have stopped to support the currency symbols in a reliable manner), US
109       mutual funds, options on US stocks, several precious metals and quite
110       possibly more; see the Yahoo! Finance website for full information.
111       Finance::YahooQuote can be used for stocks from the USA, Canada,
112       various European exchanges, various Asian exchanges (Singapore, Taiwan,
113       HongKong, Kuala Lumpur, ...) Australia and New Zealand. It should work
114       for other markets supported by Yahoo.
115
116       You may optionally override the default LWP timeout of 180 seconds by
117       setting $Finance::YahooQuote::TIMEOUT to your preferred value.
118
119       You may also provide a proxy (for the required http connection) by
120       using the variable $Finance::YahooQuote::PROXY. Furthermore,
121       authentication-based proxies can be used by setting the proxy user and
122       password via the variables $Finance::YahooQuote::PROXYUSER and
123       $Finance::YahooQuote::PROXYPASSWD.
124
125       Two example scripts are provided to help with the mapping a stock
126       symbols as well as with Yahoo! Finance server codes. The regression
127       tests scripts in the t/ subdirectory of the source distribution also
128       contain simple examples.
129
130   The available custom fields
131       The following list contains all the available data fields at Yahoo!
132       along with the corresponding format string entry:
133
134             Symbol                            s
135             Name                              n
136             Last Trade (With Time)            l
137             Last Trade (Price Only)           l1
138             Last Trade Date                   d1
139             Last Trade Time                   t1
140             Last Trade Size                   k3
141             Change and Percent Change         c
142             Change                            c1
143             Change in Percent                 p2
144             Ticker Trend                      t7
145             Volume                            v
146             Average Daily Volume              a2
147             More Info                         i
148             Trade Links                       t6
149             Bid                               b
150             Bid Size                          b6
151             Ask                               a
152             Ask Size                          a5
153             Previous Close                    p
154             Open                              o
155             Day's Range                       m
156             52-week Range                     w
157             Change From 52-wk Low             j5
158             Pct Chg From 52-wk Low            j6
159             Change From 52-wk High            k4
160             Pct Chg From 52-wk High           k5
161             Earnings/Share                    e
162             P/E Ratio                         r
163             Short Ratio                       s7
164             Dividend Pay Date                 r1
165             Ex-Dividend Date                  q
166             Dividend/Share                    d
167             Dividend Yield                    y
168             Float Shares                      f6
169             Market Capitalization             j1
170             1yr Target Price                  t8
171             EPS Est. Current Yr               e7
172             EPS Est. Next Year                e8
173             EPS Est. Next Quarter             e9
174             Price/EPS Est. Current Yr         r6
175             Price/EPS Est. Next Yr            r7
176             PEG Ratio                         r5
177             Book Value                        b4
178             Price/Book                        p6
179             Price/Sales                       p5
180             EBITDA                            j4
181             50-day Moving Avg                 m3
182             Change From 50-day Moving Avg     m7
183             Pct Chg From 50-day Moving Avg    m8
184             200-day Moving Avg                m4
185             Change From 200-day Moving Avg    m5
186             Pct Chg From 200-day Moving Avg   m6
187             Shares Owned                      s1
188             Price Paid                        p1
189             Commission                        c3
190             Holdings Value                    v1
191             Day's Value Change                w1,
192             Holdings Gain Percent             g1
193             Holdings Gain                     g4
194             Trade Date                        d2
195             Annualized Gain                   g3
196             High Limit                        l2
197             Low Limit                         l3
198             Notes                             n4
199             Last Trade (Real-time) with Time  k1
200             Bid (Real-time)                   b3
201             Ask (Real-time)                   b2
202             Change Percent (Real-time)        k2
203             Change (Real-time)                c6
204             Holdings Value (Real-time)        v7
205             Day's Value Change (Real-time)    w4
206             Holdings Gain Pct (Real-time)     g5
207             Holdings Gain (Real-time)         g6
208             Day's Range (Real-time)           m2
209             Market Cap (Real-time)            j3
210             P/E (Real-time)                   r2
211             After Hours Change (Real-time)    c8
212             Order Book (Real-time)            i5
213             Stock Exchange                    x
214

FAQs

216   How can one figure out the format string?
217       Provided a My Yahoo! (http://my.yahoo.com) account, go to the following
218       URL:
219
220           http://edit.my.yahoo.com/config/edit_pfview?.vk=v1
221
222       Viewing the source of this page, you will come across the section that
223       defines the menus that let you select which elements go into a
224       particular view.  The <option> values are the strings that pick up the
225       information described in the menu item.  For example, Symbol refers to
226       the string "s" and name refers to the string "l".  Using "sl" as the
227       format string, we would get the symbol followed by the name of the
228       security.
229
230       The example script examine_server.sh shows this in some more detail and
231       downloads example .csv files using GNU wget.
232
233   What about different stock symbols for the same corporation?
234       This can be issue. For the first few years, Yahoo! Finance's servers
235       appeared to be cover their respective local markets. E.g., the UK-based
236       servers provided quotes for Europe, the Australian one for the
237       Australia and New Zealand and so on.  Hence, one needed to branch and
238       bound code and map symbols to their region's servers.
239
240       It now appears that this is no longer required, which is good news as
241       it simplifies coding. However, some old symbols are no longer supported
242       -- yet other, and supported, codes exist for the same company.  For
243       example, German stocks used to quoted in terms or their cusip-like
244       'WKN'. The main server does not support these, but does support newer,
245       acronym-based symbols.  The example script examine_server.sh helps in
246       finding the mapping as e.g. from 555750.F to DTEGN.F for Deutsche
247       Telekom.
248
250       Copyright 1998 - 2002 Dj Padzensky Copyright 2002 - 2007 Dirk
251       Eddelbuettel
252
253       This program is free software; you can redistribute it and/or modify it
254       under the terms of the GNU General Public License as published by the
255       Free Software Foundation; either version 2 of the License, or (at your
256       option) any later version.
257
258       The information that you obtain with this library may be copyrighted by
259       Yahoo! Inc., and is governed by their usage license.  See
260       http://www.yahoo.com/docs/info/gen_disclaimer.html for more
261       information.
262

AUTHOR

264       Dj Padzensky ("djpadz@padz.net"), PadzNet, Inc., wrote the original
265       version. Dirk Eddelbuettel ("edd@debian.org") provided several
266       extensions based on DJ's original work and is the current maintainer.
267

SEE ALSO

269       The Finance::YahooQuote home pages are found at
270       http://www.padz.net/~djpadz/YahooQuote/ and
271       http://dirk.eddelbuettel.com/code/yahooquote.html.
272
273       The smtm (Show Me The Money) program uses Finance::YahooQuote for a
274       customisable stock/portfolio ticker and chart display, see
275       http://dirk.eddelbuettel.com/code/smtm.html for more.  The beancounter
276       program uses it to store quotes in a SQL database, see
277       http://dirk.eddelbuettel.com/code/beancounter.html.
278
279
280
281perl v5.28.1                      2017-11-11                     YahooQuote(3)
Impressum