Author image Dj Padzensky


Finance::YahooQuote - Get a stock quote from Yahoo!


  use Finance::YahooQuote;
  $Finance::YahooQuote::TIMEOUT = 60;
  @quote = getonequote $symbol; # Get a quote for a single symbol
  @quotes = getquote @symbols;  # Get quotes for a bunch of symbols


This module gets stock quotes from Yahoo! Finance. The getonequote function will return a quote for a single stock symbol, while the getquote function will return a quote for each of the stock symbols passed to it. The return value of getonequote is an array, with the following elements:

    0 Symbol
    1 Company Name
    2 Last Price
    3 Last Trade Date
    4 Last Trade Time
    5 Change
    6 Percent Change
    7 Volume
    8 Average Daily Vol
    9 Bid
    10 Ask
    11 Previous Close
    12 Today's Open
    13 Day's 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

The getquote function returns an array of pointers to arrays with the above structure.

You may optionally override the default LWP timeout of 180 seconds by setting $Finance::YahooQuote::TIMEOUT to your preferred value.


If there's one question I get asked over and over again, it's how did I figure out the format string? Having typed the answer in innumerable emails, I figure sticking it directly into the man page might help save my fingers a bit...

If you have a My Yahoo! ( account, go to the following URL:

Viewing the source of this page, you'll come across the section that defines the menus that let you select which elements go into a particular view. The <option> values are the strings that pick up the information described in the menu item. For example, Symbol refers to the string "s" and name refers to the string "l". Using "sl" as the format string, we would get the symbol followed by the name of the security.

If you have questions regarding this, play around with $QURL, changing the value of the f parameter.


Copyright 1998, Dj Padzensky

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The information that you obtain with this library may be copyrighted by Yahoo! Inc., and is governed by their usage license. See for more information.


Dj Padzensky (, PadzNet, Inc.


The Finance::YahooQuote home page can be found at

Show Me The Money, a derivative work by Dirk Eddelbüttel, that uses Finance::YahooQuote in a graphical environment, can be found at

1 POD Error

The following errors were encountered while parsing the POD:

Around line 161:

Non-ASCII character seen before =encoding in 'Eddelbüttel,'. Assuming ISO8859-1