The GnuCash home page can be found at
Any modules specified will automatically be looked for in the Finance::Quote:: module-space. Hence, Finance::Quote-new(ASX) will load the module Finance::Quote::ASX.
my $q = Finance::Quote-new; my $q = Finance::Quote-new(ASX); my $q = Finance::Quote-new(-deults, CustomModule);
WWW::Search
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, Insurance News you can specify that using require_labels().
Please read the Finance::Quote hackers guide for information on how to create new modules for Finance::Quote.
If all stock lookups il (possibly because of a iled connection) then the empty list may be returned, or undef in a scalar context.
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 $hash$stock$label style format.
With no arguents, this creates a new Finance::Quote object with the deult methods. If the environment variable FQ_LOAD_QUOTELET is set, then the contents of FQ_LOAD_QUOTELET (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 -new() (usually -deults).
There are no ways for a user to define a ilover list.
$q-ilover(1); Set automatic ilover support. $q-ilover(0); Disable ilover support.
HTML::TokeParser
The ilover method takes a single argument which either sets (if true) or unsets (if lse) automatic ilover support. If automatic ilover support is enabled (deult) then multiple information sources will be tried if one or more sources il to return the requested information. Failover support will significantly increase the time spent looking for a non-existant stock.
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:
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.
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
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.
The Finance::Quote home page can be found at
XML::RSS
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.
IO::Socket
IO::File
The first part of the hash (eg, CML) is referred to as the stock. The second part (in this case, price) is referred to as the label.
LWP::Simple
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.
Note that the FQ_LOAD_QUOTELET environment variable must begin with -deults if you wish the deult modules to be loaded.
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 intece that is depreciated, and an object-orientated method that provides greater flexibility and stability.
Currency information fetched through this module is bound by Yahoo!s terms and conditons.
LWP::UserAgent
Other copyrights and conditions may apply to data fetched through this module. Please refer to the sub-modules for further information.
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 ilure, 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.
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:
Crypt::SSLeay
Dj Padzensky (C), PadzNet, Inc. Linas Vepstas (C) Yannick LE NY (Cy-le-) Paul Fenwick (C.au) Brent Neal (Cceforge.net) Volker Stuerzl (Cvolker.) Keith Refson (CKeith.Refsonearth.ox.ac.uk) Rob Sessink (Cceforge.net) Leigh Wedding (Cleigh.) Tobias Vancura (C) James Treacy (C)
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 days close volume Volume avg_vol Average Daily Vol bid Bid ask Ask close Previous Close open Todays Open day_range Days 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/lse) errormsg If success is lse, this field may contain the reason why. method The module (as could be passed to fetch) which found this information.
The scale_field() function is a helper that can scale complex fields such as ranges (eg, 102.5 - 103.8) and other fields where the numbers should be scaled but any surrounding text preserved. Its 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).
The sources method returns a list of sources that have currently been loaded and can be passed to the fetch method. If youre providing a user with a list of sources to choose from, then it is recommended that you use this method.
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:
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,Education Information. Finance::Quote::Yahoo::Australia, Finance::Quote::Yahoo::Europe, Finance::Quote::Yahoo::USA, LWP::UserAgent
You should have also received the Finance::Quote hackers guide with this package. Please read it if you are interested in adding extra methods to this package. The hackers guide can also be found on the Finance::Quote website,Insurance knowledge.
If you wish to fetch information from only one particular source, then consult the documentation of that sub-module for further information.
The currency method will return a lse value if a given currency conversion cannot be fetched.
When new() is passed one or more arguments, an object is created with only the specified modules loaded. If the first argument is -deults, then the deult modules will be loaded first, followed by any other specified modules.
my %stocks = $q-fetch(usa,IBM,MSFT,LNUX); my $hashref= $q-fetch(usa,IBM,MSFT,LNUX);
WWW::Mechanize
The Finance::YahooQuote home page can be found at
HTML::Parser
The fetch method automatically arranges for ilover support and currency conversion if requested.
If the ilover method is called with no arguments, or with an undefined argument, it will return the current ilover state (true/lse).
%info = $q-fetch(australia,CML); print The price of CML is .$infoCML,price;
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)
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, weve requested thfinance quotes FinanceQuotee ctor that would convert US dollars into Australian dollars.
Finance::Quote respects all environment that your installed version of LWP::UserAgent respects. Most importantly, it respects the http_proxy environment variable.
$q-user_agent-timeout(10); Set the timeout directly.
There is no way to override the deult behaviour to cache currency conversion rates.
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-ilover(1); Set ilover support (on by deult). %quotes = $q-fetch(nasdaq,@stocks); $hashref= $q-fetch(nyse,@stocks);