NAME
Finance::Quote - Get stock and mutual fund quotes from various exchanges
SYNOPSIS
use Finance::Quote;
my $q = Finance::Quote->new; # New Finance::Quote object.
$q->timeout(60); # Timeout max of 60 seconds
%quotes = $q->yahoo(@symbols); # NYSE quotes
%quotes = $q->yahoo_europe(@symbols); # Europe quotes
%quotes = $q->fidelity(@symbols); # Fidelity Investments Quotes
%quotes = $q->troweprice(); # Quotes from T. Rowe Price
%quotes = $q->tiaacref(@symbols); # Annuities from TIAA-CREF
%quotes = $q->asx(@symbols); # Australian quotes from ASX.
%quotes = $q->fetch("asx",@symbols); # Same as above, different syntax.
print ("the last price was ", $quotes{"IBM", "last"} );
DESCRIPTION
This module gets stock quotes from various internet sources, including Yahoo! Finance, Fidelity Investments, and the Australian Stock Exchange. The functions will return a quote for each of the stock symbols passed to it. The return value of each of the routines is a hash, which may include one or more of the following elements:
name Company or Mutual Fund Name
last Last Price
high Highest trade today
low Lowest trade today
date Last Trade Date (MM/DD/YY format)
time Last Trade Time
net Net Change
p_change Percent Change from previous day's close
volume Volume
avg_vol Average Daily Vol
bid Bid
ask Ask
close Previous Close
open Today's Open
day_range Day's Range
year_range 52-Week Range
eps Earnings per Share
pe P/E Ratio
div_date Dividend Pay Date
div Dividend per Share
div_yield Dividend Yield
cap Market Capitalization
ex_div Ex-Dividend Date.
nav Net Asset Value
yield Yield (usually 30 day avg)
success Did the stock successfully return information? (true/false)
errormsg If success is false, this field may contain the reason why.
(Elements which are not yet implemented have no key associated
with them. Not all methods return all keys at all times.)
If all stock lookups fail (possibly because of a failed connection) then `undef' may be returned.
You may optionally override the default LWP timeout of 180 seconds by setting $quote->timeout() or Finance::Quote::timeout() to your preferred value.
Note that prices from the Australian Stock Exchange (ASX) are in Australian Dollars. Prices from Yahoo! Europe are in Euros. All other prices are in US Dollars.
troweprice
The troweprice() function ignores any arguments passed to it. Instead it returns all funds managed by T.RowePrice.
tiaacref
For TIAA and CREF Annuities, you must use TIAA-CREF's pseudosymbols. These are as follows:
Stock: CREFstok
Money Market: CREFmony
Equity Index: CREFequi
Inflation-Linked Bond: CREFinfb
Bond Market: CREFbond
TIAA Real Estate: TIAAreal
Social Choice: CREFsoci
Teachers PA Stock Index: TIAAsndx
Global Equities: CREFglob
Teachers PA Select Stock: TIAAsele
Growth: CREFgrow
FETCH
my %stocks = $q->fetch("nasdaq","IBM","MSFT");
A new function, fetch(), provides a more generic and easy-to-use interface to the library. It takes a source as the first argument, and then a list of ticker-symbols to obtain from that source. fetch() will understand the case-insensitive sources "nasdaq", "nyse" and "europe", and map them to the yahoo or yahoo_europe methods appropriately.
ENVIRONMENT
Finance::Quote respects all environment that your installed version of LWP::UserAgent respects. Most importantly, it respects the http_proxy environment variable.
FAQ
If there's one question I get asked over and over again, it's how did I figure out the format string for Yahoo! quotes? 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! (http://my.yahoo.com) account, go to the following URL:
http://edit.my.yahoo.com/config/edit_pfview?.vk=v1
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 $YAHOO_URL, changing the value of the f parameter.
BUGS
Not all functions return an errormsg when a failure results.
Not everything checks for errors as well as they could.
There is no way to add extra aliases to the fetch list.
There is no good documentation on which functions return what fields.
This documentation is getting a little long and cumbersome. It should be broken up into more logical sections.
COPYRIGHT
Copyright 1998, Dj Padzensky
Copyright 1998, 1999 Linas Vepstas
Copyright 2000, Yannick LE NY (update for Yahoo Europe and YahooQuote)
Copyright 2000, Paul Fenwick (update for ASX)
Copyright 2000, Brent Neal (update for TIAA-CREF)
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 http://www.yahoo.com/docs/info/gen_disclaimer.html for more information.
The information that you obtain with this library may be copyrighted by the ASX, and is governed by its usage license. See http://www3.asx.com.au/Fdis.htm for more information.
The information that you obtain with this library may be copyrighted by TIAA-CREF, and is governed by its usage license.
Other copyrights and conditions may apply to data fetched through this module.
AUTHORS
Dj Padzensky (C<djpadz@padz.net>), PadzNet, Inc.
Linas Vepstas (C<linas@linas.org>)
Yannick LE NY (C<y-le-ny@ifrance.com>)
Paul Fenwick (C<pjf@schools.net.au>)
Brent Neal (C<brent@phys.lsu.edu>)
The Finance::Quote home page can be found at http://finance-quote.sourceforge.net/
The Finance::YahooQuote home page can be found at http://www.padz.net/~djpadz/YahooQuote/
The GnuCash home page can be found at http://www.gnucash.org/