.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Finance::Quote 3pm" .TH Finance::Quote 3pm "2015-08-22" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Finance::Quote \- Get stock and mutual fund quotes from various exchanges .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Finance::Quote; \& $q = Finance::Quote\->new; \& \& $q\->timeout(60); \& \& $conversion_rate = $q\->currency("AUD","USD"); \& $q\->set_currency("EUR"); # Return all info in Euros. \& \& $q\->require_labels(qw/price date high low volume/); \& \& $q\->failover(1); # Set failover support (on by default). \& \& %quotes = $q\->fetch("nasdaq",@stocks); \& $hashref = $q\->fetch("nyse",@stocks); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module gets stock quotes from various internet sources, including Yahoo! Finance, Fidelity Investments, and the Australian Stock Exchange. There are two methods of using this module \*(-- a functional interface that is deprecated, and an object-orientated method that provides greater flexibility and stability. .PP With the exception of straight currency exchange rates, all information is returned as a two-dimensional hash (or a reference to such a hash, if called in a scalar context). For example: .PP .Vb 2 \& %info = $q\->fetch("australia","CML"); \& print "The price of CML is ".$info{"CML","price"}; .Ve .PP The first part of the hash (eg, \*(L"\s-1CML\*(R"\s0) is referred to as the stock. The second part (in this case, \*(L"price\*(R") is referred to as the label. .SS "\s-1LABELS\s0" .IX Subsection "LABELS" When information about a stock is returned, the following standard labels may be used. Some custom-written modules may use labels not mentioned here. If you wish to be certain that you obtain a certain set of labels for a given stock, you can specify that using \fIrequire_labels()\fR. .PP .Vb 10 \& 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\*(Aqs close \& volume Volume \& avg_vol Average Daily Vol \& bid Bid \& ask Ask \& close Previous Close \& open Today\*(Aqs Open \& day_range Day\*(Aqs 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) \& exchange The exchange the information was obtained from. \& success Did the stock successfully return information? (true/false) \& errormsg If success is false, this field may contain the reason why. \& method The module (as could be passed to fetch) which found this \& information. \& type The type of equity returned .Ve .PP If all stock lookups fail (possibly because of a failed connection) then the empty list may be returned, or undef in a scalar context. .SH "INSTALLATION" .IX Header "INSTALLATION" To install this module, run the following commands: .PP .Vb 4 \& perl Makefile.PL \& make \& make test \& make install .Ve .PP For more detailed instructions, please see the \s-1INSTALL\s0 file. .SH "SUPPORT AND DOCUMENTATION" .IX Header "SUPPORT AND DOCUMENTATION" After installing, you can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Finance::Quote .Ve .PP You can also look for information at: .IP "\s-1RT, CPAN\s0's request tracker" 4 .IX Item "RT, CPAN's request tracker" http://rt.cpan.org/NoAuth/Bugs.html?Dist=Finance\-Quote .IP "AnnoCPAN, Annotated \s-1CPAN\s0 documentation" 4 .IX Item "AnnoCPAN, Annotated CPAN documentation" http://annocpan.org/dist/Finance\-Quote .IP "\s-1CPAN\s0 Ratings" 4 .IX Item "CPAN Ratings" http://cpanratings.perl.org/d/Finance\-Quote .IP "Search \s-1CPAN\s0" 4 .IX Item "Search CPAN" http://search.cpan.org/dist/Finance\-Quote .IP "The Finance::Quote home page" 4 .IX Item "The Finance::Quote home page" http://finance\-quote.sourceforge.net/ .IP "The Finance::YahooQuote home page" 4 .IX Item "The Finance::YahooQuote home page" http://www.padz.net/~djpadz/YahooQuote/ .IP "The GnuCash home page" 4 .IX Item "The GnuCash home page" http://www.gnucash.org/ .SH "AVAILABLE METHODS" .IX Header "AVAILABLE METHODS" .SS "\s-1NEW\s0" .IX Subsection "NEW" .Vb 3 \& my $q = Finance::Quote\->new; \& my $q = Finance::Quote\->new("ASX"); \& my $q = Finance::Quote\->new("\-defaults", "CustomModule"); .Ve .PP With no arguents, this creates a new Finance::Quote object with the default methods. If the environment variable \&\s-1FQ_LOAD_QUOTELET\s0 is set, then the contents of \s-1FQ_LOAD_QUOTELET \&\s0(split on whitespace) will be used as the argument list. This allows users to load their own custom modules without having to change existing code. If you do not want users to be able to load their own modules at run-time, pass an explicit argumetn to \->\fInew()\fR (usually \&\*(L"\-defaults\*(R"). .PP When \fInew()\fR is passed one or more arguments, an object is created with only the specified modules loaded. If the first argument is \&\*(L"\-defaults\*(R", then the default modules will be loaded first, followed by any other specified modules. .PP Note that the \s-1FQ_LOAD_QUOTELET\s0 environment variable must begin with \*(L"\-defaults\*(R" if you wish the default modules to be loaded. .PP Any modules specified will automatically be looked for in the Finance::Quote:: module-space. Hence, Finance::Quote\->new(\*(L"\s-1ASX\*(R"\s0) will load the module Finance::Quote::ASX. .PP Please read the Finance::Quote hacker's guide for information on how to create new modules for Finance::Quote. .SS "\s-1FETCH\s0" .IX Subsection "FETCH" .Vb 2 \& my %stocks = $q\->fetch("usa","IBM","MSFT","LNUX"); \& my $hashref = $q\->fetch("usa","IBM","MSFT","LNUX"); .Ve .PP Fetch takes an exchange as its first argument. The second and remaining arguments are treated as stock-names. In the standard Finance::Quote distribution, the following exchanges are recognised: .PP .Vb 10 \& australia Australan Stock Exchange \& dwsfunds Deutsche Bank Gruppe funds \& fidelity Fidelity Investments \& tiaacref TIAA\-CREF \& troweprice T. Rowe Price \& europe European Markets \& canada Canadian Markets \& usa USA Markets \& nyse New York Stock Exchange \& nasdaq NASDAQ \& uk_unit_trusts UK Unit Trusts \& vanguard Vanguard Investments \& vwd Vereinigte Wirtschaftsdienste GmbH .Ve .PP When called in an array context, a hash is returned. In a scalar context, a reference to a hash will be returned. The structure of this hash is described earlier in this document. .PP The fetch method automatically arranges for failover support and currency conversion if requested. .PP If you wish to fetch information from only one particular source, then consult the documentation of that sub-module for further information. .SS "\s-1SOURCES\s0" .IX Subsection "SOURCES" .Vb 2 \& my @sources = $q\->sources; \& my $listref = $q\->sources; .Ve .PP The sources method returns a list of sources that have currently been loaded and can be passed to the fetch method. If you're providing a user with a list of sources to choose from, then it is recommended that you use this method. .SS "\s-1CURRENCY_LOOKUP\s0" .IX Subsection "CURRENCY_LOOKUP" .Vb 4 \& $currencies_by_name = $q\->currency_lookup( name => \*(AqAustralian\*(Aq ); \& $currencies_by_code = $q\->currency_lookup( code => qr/^b/i ); \& $currencies_by_both = $q\->currency_lookup( name => qr/pound/i \& , code => \*(AqGB\*(Aq ); .Ve .PP The currency_lookup method provides a search against the known currencies. The list of currencies is based on the available currencies in the Yahoo Currency Converter (the list is stored within the module as the list should be fairly static). .PP The lookup can be done by currency name (ie \*(L"Australian Dollar\*(R"), by code (ie \*(L"\s-1AUD\*(R"\s0) or both. You can pass either a scalar or regular expression as a search value \- scalar values are matched by substring while regular expressions are matched as-is (no changes are made to the expression). .PP See Finance::Quote::Currencies::fetch_live_currencies (and the \&\f(CW\*(C`t/currencies.t\*(C'\fR test file) for a way to make sure that the stored currency list is up to date. .SS "\s-1CURRENCY\s0" .IX Subsection "CURRENCY" .Vb 1 \& $conversion_rate = $q\->currency("USD","AUD"); .Ve .PP The currency method takes two arguments, and returns a conversion rate that can be used to convert from the first currency into the second. In the example above, we've requested the factor that would convert \&\s-1US\s0 dollars into Australian dollars. .PP The currency method will return a false value if a given currency conversion cannot be fetched. .PP At the moment, currency rates are fetched from Yahoo!, and the information returned is governed by Yahoo!'s terms and conditions. See Finance::Quote::Yahoo for more information. .SS "\s-1SET_CURRENCY\s0" .IX Subsection "SET_CURRENCY" .Vb 1 \& $q\->set_currency("FRF"); # Get results in French Francs. .Ve .PP The set_currency method can be used to request that all information be returned in the specified currency. Note that this increases the chance stock-lookup failure, as remote requests must be made to fetch both the stock information and the currency rates. In order to improve reliability and speed performance, currency conversion rates are cached and are assumed not to change for the duration of the Finance::Quote object. .PP At this time, currency conversions are only looked up using Yahoo!'s services, and hence information obtained with automatic currency conversion is bound by Yahoo!'s terms and conditions. .SS "\s-1FAILOVER\s0" .IX Subsection "FAILOVER" .Vb 2 \& $q\->failover(1); # Set automatic failover support. \& $q\->failover(0); # Disable failover support. .Ve .PP The failover method takes a single argument which either sets (if true) or unsets (if false) automatic failover support. If automatic failover support is enabled (default) then multiple information sources will be tried if one or more sources fail to return the requested information. Failover support will significantly increase the time spent looking for a non-existant stock. .PP If the failover method is called with no arguments, or with an undefined argument, it will return the current failover state (true/false). .SS "\s-1USER_AGENT\s0" .IX Subsection "USER_AGENT" .Vb 1 \& my $ua = $q\->user_agent; .Ve .PP The user_agent method returns the LWP::UserAgent object that Finance::Quote and its helpers use. Normally this would not be useful to an application, however it is possible to modify the user-agent directly using this method: .PP .Vb 1 \& $q\->user_agent\->timeout(10); # Set the timeout directly. .Ve .SS "\s-1SCALE_FIELD\s0" .IX Subsection "SCALE_FIELD" .Vb 1 \& my $pounds = $q\->scale_field($item_in_pence,0.01); .Ve .PP The \fIscale_field()\fR function is a helper that can scale complex fields such as ranges (eg, \*(L"102.5 \- 103.8\*(R") and other fields where the numbers should be scaled but any surrounding text preserved. It's most useful in writing new Finance::Quote modules where you may retrieve information in a non\-ISO4217 unit (such as cents) and would like to scale it to a more useful unit (like dollars). .SS "\s-1ISOTIME\s0" .IX Subsection "ISOTIME" .Vb 2 \& $q\->isoTime("11:39PM"); # returns "23:39" \& $q\->isoTime("9:10 AM"); # returns "09:10" .Ve .PP This function will return a isoformatted time .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" Finance::Quote respects all environment that your installed version of LWP::UserAgent respects. Most importantly, it respects the http_proxy environment variable. .SH "BUGS" .IX Header "BUGS" There are no ways for a user to define a failover list. .PP The two-dimensional hash is a somewhat unwieldly method of passing around information when compared to references. A future release is planned that will allow for information to be returned in a more flexible \f(CW$hash\fR{$stock}{$label} style format. .PP There is no way to override the default behaviour to cache currency conversion rates. .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" .Vb 12 \& Copyright 1998, Dj Padzensky \& Copyright 1998, 1999 Linas Vepstas \& Copyright 2000, Yannick LE NY (update for Yahoo Europe and YahooQuote) \& Copyright 2000\-2001, Paul Fenwick (updates for ASX, maintainence and release) \& Copyright 2000\-2001, Brent Neal (update for TIAA\-CREF) \& Copyright 2000 Volker Stuerzl (DWS and VWD support) \& Copyright 2000 Keith Refson (Trustnet support) \& Copyright 2001 Rob Sessink (AEX support) \& Copyright 2001 Leigh Wedding (ASX updates) \& Copyright 2001 Tobias Vancura (Fool support) \& Copyright 2001 James Treacy (TD Waterhouse support) \& Copyright 2008 Erik Colson (isoTime) .Ve .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP Currency information fetched through this module is bound by Yahoo!'s terms and conditons. .PP Other copyrights and conditions may apply to data fetched through this module. Please refer to the sub-modules for further information. .SH "AUTHORS" .IX Header "AUTHORS" .Vb 10 \& Dj Padzensky , PadzNet, Inc. \& Linas Vepstas \& Yannick LE NY \& Paul Fenwick \& Brent Neal \& Volker Stuerzl \& Keith Refson \& Rob Sessink \& Leigh Wedding \& Tobias Vancura \& James Treacy \& Bradley Dean \& Erik Colson .Ve .PP The Finance::Quote home page can be found at http://finance\-quote.sourceforge.net/ .PP The Finance::YahooQuote home page can be found at http://www.padz.net/~djpadz/YahooQuote/ .PP The GnuCash home page can be found at http://www.gnucash.org/ .SH "SEE ALSO" .IX Header "SEE ALSO" Finance::Quote::AEX, Finance::Quote::ASX, Finance::Quote::Cdnfundlibrary, Finance::Quote::DWS, Finance::Quote::Fidelity, Finance::Quote::FinanceCanada, Finance::Quote::Fool, Finance::Quote::FTPortfolios, Finance::Quote::Tdefunds, Finance::Quote::Tdwaterhouse, Finance::Quote::Tiaacref, Finance::Quote::Troweprice, Finance::Quote::Trustnet, Finance::Quote::VWD, Finance::Quote::Yahoo::Australia, Finance::Quote::Yahoo::Europe, Finance::Quote::Yahoo::USA, LWP::UserAgent .PP You should have also received the Finance::Quote hacker's guide with this package. Please read it if you are interested in adding extra methods to this package. The hacker's guide can also be found on the Finance::Quote website, http://finance\-quote.sourceforge.net/