mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-27 03:10:23 -06:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2168 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
2f8a01a6f4
commit
42af9b1022
@ -1,5 +1,14 @@
|
||||
2000-04-08 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/scm/report/balance-and-pnl.scm: remove the report description.
|
||||
It just looked wierd!
|
||||
|
||||
* src/scm/command-line.scm (gnc:prefs-show-version): use the
|
||||
configured version instead of hard-coding it.
|
||||
|
||||
* src/scm/bootstrap.scm.in (gnc:version): configure this guile
|
||||
variable with the gnucash version info.
|
||||
|
||||
* src/SplitLedger.c (xaccLoadXferCell): == not = Doh!!!
|
||||
|
||||
2000-04-07 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
@ -569,6 +569,7 @@ Matt Martin <mgmartin@abacusnet.net> guile error handling code
|
||||
Robert Graham Merkel <rgmerk@mira.net> reporting, gnome, and config patches
|
||||
Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu> port to alpha-dec-osf4.0f
|
||||
G. Allen Morris III <gam3@ann.softgams.com> for QIF core dump
|
||||
Brent Neal <brent@baton.phys.lsu.edu> TIAA-CREF support.
|
||||
Peter Norton <spacey@inch.com> for a valiant attempt at a GTK port
|
||||
OmNiBuS <webmaster@obsidian.uia.net> web site graphics & content
|
||||
Myroslav Opyr <mopyr@IPM.Lviv.UA> for misc patches
|
||||
|
@ -380,6 +380,10 @@
|
||||
|
||||
<dd>for QIF core dump fix</dd>
|
||||
|
||||
<dt> <a href="mailto:brent@baton.phys.lsu.edu"> Brent Neal</a></dt>
|
||||
|
||||
<dd>TIAA-CREF support.</dd>
|
||||
|
||||
<dt> <a href="mailto:spacey@inch.com"> Peter Norton</a></dt>
|
||||
|
||||
<dd>for a valiant attempt at a GTK port</dd>
|
||||
|
@ -34,15 +34,16 @@
|
||||
<li>Select a quote source from the pull-down menu. Currently
|
||||
supported quote sources include <b>Yahoo</b>, <b>Yahoo
|
||||
Europe</b>, <b>Fidelity Investments</b>, <b>T. Rowe Price</b>,
|
||||
the <b>Vanguard Group</b> and <b>the Australian Stock
|
||||
Exchange</b> (ASX). Note that Yahoo will provide price quotes
|
||||
for many mutual funds <i>including</i> Fidelity, T.Rowe Price
|
||||
and Vanguard, and that the quoted prices at Yahoo <i>should</i>
|
||||
be identical to those that may be found at the source sites
|
||||
(otherwise, somebody's reporting wrong information!). If you
|
||||
choose Yahoo Europe, you should append the market code for the
|
||||
security, such as PA for Paris, BE for Berlin, etc. Example:
|
||||
12150.PA (a Peugot security in the Paris market).
|
||||
the <b>Vanguard Group</b>, <b>the Australian Stock
|
||||
Exchange</b> (ASX) and <b>TIAA-CREF</b>. Note that Yahoo will
|
||||
provide price quotes for many mutual funds <i>including</i>
|
||||
Fidelity, T.Rowe Price and Vanguard, and that the quoted prices
|
||||
at Yahoo <i>should</i> be identical to those that may be found
|
||||
at the source sites (otherwise, somebody's reporting wrong
|
||||
information!). If you choose Yahoo Europe, you should append the
|
||||
market code for the security, such as PA for Paris, BE for
|
||||
Berlin, etc. Example: 12150.PA (a Peugot security in the Paris
|
||||
market).
|
||||
|
||||
<li>Ensure that the currency of the account matches the source
|
||||
of the stock you have selected. This means:
|
||||
@ -191,6 +192,59 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<caption>
|
||||
Psuedo-symbols that can be used for TIAA-CREF quotes.
|
||||
</caption>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Psuedo-symbol</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Stock</td>
|
||||
<td>CREFstok</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Money Market</td>
|
||||
<td>CREFmony</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Equity Index</td>
|
||||
<td>CREFequi</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Inflation-Linked Bond</td>
|
||||
<td>CREFinfb</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bond Market</td>
|
||||
<td>CREFbond</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TIAA Real Estate</td>
|
||||
<td>TIAAreal</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Social Choice</td>
|
||||
<td>CREFsoci</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Teachers PA Stock Index</td>
|
||||
<td>TIAAsndx</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Global Equities</td>
|
||||
<td>CREFglob</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Teachers PA Select Stock</td>
|
||||
<td>TIAAsele</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Growth</td>
|
||||
<td>CREFgrow</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>A sample image is shown below:<br>
|
||||
<img src="ticker-a.gif" alt="Sample Diagram"></p>
|
||||
|
@ -14,13 +14,12 @@
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
* *
|
||||
* Author: Rob Clark *
|
||||
* Internet: rclark@cs.hmc.edu *
|
||||
* Address: 609 8th Street *
|
||||
* Huntington Beach, CA 92648-4632 *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __XACC_ACCOUNT_H__
|
||||
@ -39,12 +38,12 @@ void xaccFreeAccount( Account * );
|
||||
|
||||
/*
|
||||
* The xaccAccountBeginEdit() and xaccAccountCommitEdit() subroutines
|
||||
* provide a psuedo-two-phase-commit wrapper for account updates.
|
||||
* provide a pseudo-two-phase-commit wrapper for account updates.
|
||||
* They are mildly useful for detecting attempted updates outside
|
||||
* of thier scope. However, they do not provide any true two-phase-anything
|
||||
* of their scope. However, they do not provide any true two-phase-anything
|
||||
* in the current implementation.
|
||||
*
|
||||
* The defer flag, if sett, will defer all attempts at rebalancing
|
||||
* The defer flag, if set, will defer all attempts at rebalancing
|
||||
* of accounts until the commit.
|
||||
*/
|
||||
void xaccAccountBeginEdit (Account *, int defer);
|
||||
@ -84,7 +83,7 @@ void xaccZeroRunningBalances (Account **list);
|
||||
* returns +1 if the first is "greater than" the second, and
|
||||
* 0 if they are equal. To determine the sort order, first
|
||||
* the account codes are compared, and if these are equal, then
|
||||
* account types, and, if these are queal, the account names.
|
||||
* account types, and, if these are equal, the account names.
|
||||
*/
|
||||
int xaccAccountOrder (Account**, Account **);
|
||||
|
||||
|
@ -26,14 +26,14 @@ include @top_srcdir@/Makefile.init
|
||||
|
||||
INCLPATH = -I@srcdir@/../../include -I@srcdir@/../.. -I@prefix@/include
|
||||
|
||||
# we want to add the -fpic flag to generate relocatable position independent code
|
||||
# add the -fpic flag to generate relocatable position independent code
|
||||
# for the engine so that in can be used in a shared module (e.g. a perl module)
|
||||
CFLAGS = @CFLAGS@ ${INCLPATH} -fpic
|
||||
|
||||
######################################################################
|
||||
# See Makefile.common for information about these variables.
|
||||
INDEP_SRCS := AccInfo.c Account.c DateUtils.c FileIO.c Group.c \
|
||||
LedgerUtils.c QIFIO.c Query.c Queue.c Scrub.c Session.c \
|
||||
LedgerUtils.c QIFIO.c Query.c Queue.c Scrub.c Session.c \
|
||||
Transaction.c TransLog.c date.c util.c
|
||||
######################################################################
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
* 2) Provides a search path for the file to be edited. This should
|
||||
* simplify install & maintenance problems for naive users who
|
||||
* may not have a good grasp on what a file ssytem is, or where
|
||||
* they want to keep thier data files.
|
||||
* they want to keep their data files.
|
||||
*
|
||||
* The current implementations assumes the use of files and file
|
||||
* locks; however, the API was designed to be general enough to
|
||||
@ -122,8 +122,8 @@ void xaccSessionDestroy (Session *);
|
||||
* circustances.
|
||||
*
|
||||
* The xaccSessionEnd() method will release the session lock. It will *not*
|
||||
* save the account group to a file. Thus, this method acts as an "abort" or
|
||||
* "rollback" primitive.
|
||||
* save the account group to a file. Thus, this method acts as an "abort"
|
||||
* or "rollback" primitive.
|
||||
*
|
||||
* The xaccResolveFilePath() routine is a utility that will accept a
|
||||
* fragmentary filename as input, and resolve it into a fully-qualified path
|
||||
|
@ -15,7 +15,8 @@
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA *
|
||||
* 02111-1307, USA *
|
||||
\********************************************************************/
|
||||
|
||||
#include "top-level.h"
|
||||
@ -203,6 +204,8 @@ gnc_get_source_name(gint source)
|
||||
return "Vanguard";
|
||||
case SOURCE_ASX :
|
||||
return "ASX";
|
||||
case SOURCE_TIAA_CREF :
|
||||
return "TIAA-CREF";
|
||||
}
|
||||
|
||||
PWARN("Unknown source");
|
||||
@ -229,6 +232,8 @@ gnc_get_source_code_name(gint source)
|
||||
return "VANGUARD";
|
||||
case SOURCE_ASX :
|
||||
return "ASX";
|
||||
case SOURCE_TIAA_CREF :
|
||||
return "TIAACREF";
|
||||
}
|
||||
|
||||
PWARN("Unknown source");
|
||||
|
@ -15,7 +15,8 @@
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA *
|
||||
* 02111-1307, USA *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __DIALOG_UTILS_H__
|
||||
@ -65,6 +66,7 @@ enum
|
||||
SOURCE_TROWEPRICE,
|
||||
SOURCE_VANGUARD,
|
||||
SOURCE_ASX,
|
||||
SOURCE_TIAA_CREF,
|
||||
NUM_SOURCES
|
||||
};
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
#
|
||||
# Copyright (C) 1998, Dj Padzensky <djpadz@padz.net>
|
||||
# Copyright (C) 1998, 1999 Linas Vepstas <linas@linas.org>
|
||||
# Copyright (C) 2000 Yannick LE NY <y-le-ny@ifrance.com>
|
||||
# Copyright (C) 2000, Yannick LE NY <y-le-ny@ifrance.com>
|
||||
# Copyright (C) 2000, Paul Fenwick <pjf@schools.net.au>
|
||||
# Copyright (C) 2000, Brent Neal <brent@phys.lsu.edu>
|
||||
#
|
||||
# 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
|
||||
@ -17,31 +18,41 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA
|
||||
#
|
||||
#
|
||||
|
||||
# This code derived from Padzensky's work on package Finance::YahooQuote,
|
||||
# but extends its capabilites to encompas a greater number of data sources.
|
||||
#
|
||||
# package Finance::YahooQuote;
|
||||
package Quote;
|
||||
require 5.000;
|
||||
# This code was developed as part of GnuCash <http://www.gnucash.org/>
|
||||
|
||||
# package Finance::Quote;
|
||||
package Quote;
|
||||
require 5.004;
|
||||
|
||||
require Exporter;
|
||||
use strict;
|
||||
use vars qw($VERSION @EXPORT @ISA $TIMEOUT
|
||||
use vars qw($VERSION @EXPORT @ISA $TIMEOUT @EXPORT_OK @EXPORT_TAGS
|
||||
$YAHOO_URL $YAHOO_EUROPE_URL
|
||||
$FIDELITY_GANDI_URL $FIDELITY_GROWTH_URL $FIDELITY_CORPBOND_URL
|
||||
$FIDELITY_GLBND_URL $FIDELITY_MM_URL $FIDELITY_ASSET_URL
|
||||
$TROWEPRICE_URL
|
||||
$VANGUARD_QUERY_URL $VANGUARD_CSV_URL @vanguard_ids
|
||||
$ASX_URL);
|
||||
$ASX_URL $TIAACREF_URL %tiaacref_ids);
|
||||
|
||||
use LWP::UserAgent;
|
||||
use HTTP::Request::Common;
|
||||
use Exporter ();
|
||||
|
||||
$VERSION = '0.14';
|
||||
@ISA = qw(Exporter);
|
||||
# Export information
|
||||
@ISA = qw/Exporter/;
|
||||
@EXPORT = ();
|
||||
@EXPORT_OK = qw/yahoo yahoo_europe fidelity troweprice vanguard asx tiaacref/;
|
||||
@EXPORT_TAGS = ( all => [@EXPORT_OK] );
|
||||
|
||||
$VERSION = '0.17';
|
||||
|
||||
# URLs of where to obtain information.
|
||||
|
||||
$YAHOO_URL = ("http://quote.yahoo.com/d?f=snl1d1t1c1p2va2bapomwerr1dyj1&s=");
|
||||
$YAHOO_EUROPE_URL = ("http://finance.fr.yahoo.com/d/quotes.csv?f=snl1d1t1c1p2va2bapomwerr1dyj1&s=");
|
||||
@ -55,15 +66,36 @@ $TROWEPRICE_URL = ("http://www.troweprice.com/funds/prices.csv");
|
||||
$VANGUARD_QUERY_URL = ("http://www.vanguard.com/cgi-bin/Custom/daily/custom/CustRpt?");
|
||||
$VANGUARD_CSV_URL = ("http://www.vanguard.com/cgi-bin/Custom?ACTION=Download&FileName=");
|
||||
$ASX_URL = ('http://www3.asx.com.au/nd50/nd_isapi_50.dll/JSP/EquitySearchResults.jsp?method=post&template=F1001&ASXCodes=');
|
||||
|
||||
# Don't export; let user invoke with Quote::getquote syntax.
|
||||
# @EXPORT = qw(&yahoo, &fidelity);
|
||||
$TIAACREF_URL = ("http://www.tiaa-cref.org/financials/selection/ann-select.cgi?");
|
||||
|
||||
undef $TIMEOUT;
|
||||
|
||||
# =======================================================================
|
||||
# Define some OO methods for use. People probably don't want to type
|
||||
# Finance::Quote::foo all the time. This is just a dummy object right
|
||||
# now.
|
||||
sub new {
|
||||
my $self = shift;
|
||||
my $class = ref($self) || $self;
|
||||
return bless {}, $class;
|
||||
}
|
||||
|
||||
# Timeout changing code. Currently this changes the timeout for everything,
|
||||
# but in the future can be used to change the timeout for a particular
|
||||
# Quote object.
|
||||
sub timeout {
|
||||
my $self = shift;
|
||||
my $timeout = shift;
|
||||
$timeout = $self unless (ref $self);
|
||||
$TIMEOUT = $timeout;
|
||||
}
|
||||
|
||||
# =======================================================================
|
||||
# Grabbed from the Perl Cookbook. Parsing csv isn't as simple as you thought!
|
||||
sub parse_csv
|
||||
#
|
||||
# Obsoleted code? I can't see this being called anywhere.
|
||||
#
|
||||
sub _parse_csv
|
||||
{
|
||||
my $text = shift; # record containing comma-separated values
|
||||
my @new = ();
|
||||
@ -85,6 +117,7 @@ sub parse_csv
|
||||
# which is primarily the new york stock exchange.
|
||||
sub yahoo
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
my @symbols = @_;
|
||||
my($x,@q,%aa,$ua,$url,$sym);
|
||||
|
||||
@ -97,7 +130,7 @@ sub yahoo
|
||||
$ua->env_proxy();
|
||||
foreach (split('\015?\012',$ua->request(GET $url)->content))
|
||||
{
|
||||
@q = parse_csv($_);
|
||||
@q = _parse_csv($_);
|
||||
|
||||
$sym = $q[0];
|
||||
$aa {$sym, "exchange"} = "NYSE"; # new york stock exchange
|
||||
@ -123,6 +156,7 @@ sub yahoo
|
||||
# yahoo_europe gets quotes for European markets from Yahoo.
|
||||
sub yahoo_europe
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
my @symbols = @_;
|
||||
my($x,@q,%aa,$ua,$url,$sym);
|
||||
|
||||
@ -135,7 +169,7 @@ sub yahoo_europe
|
||||
$ua->env_proxy();
|
||||
foreach (split('\015?\012',$ua->request(GET $url)->content))
|
||||
{
|
||||
@q = parse_csv($_);
|
||||
@q = _parse_csv($_);
|
||||
|
||||
$sym = $q[0];
|
||||
# $aa {$sym, "exchange"} = "NYSE";
|
||||
@ -162,6 +196,7 @@ sub yahoo_europe
|
||||
#
|
||||
sub fidelity
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
my @symbols = @_;
|
||||
my(%aa,%cc,$sym, $k);
|
||||
|
||||
@ -251,6 +286,7 @@ sub fidelity
|
||||
|
||||
sub fidelity_nav
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
my(@q,%aa,$ua,$url,$sym, $dayte);
|
||||
my %days = ('Monday','Mon','Tuesday','Tue','Wednesday','Wed',
|
||||
'Thursday','Thu','Friday','Fri','Saturday','Sat',
|
||||
@ -263,7 +299,7 @@ sub fidelity_nav
|
||||
$ua->env_proxy();
|
||||
foreach (split('\015?\012',$ua->request(GET $url)->content))
|
||||
{
|
||||
@q = parse_csv($_);
|
||||
@q = _parse_csv($_);
|
||||
|
||||
# extract the date which is usually on the second line fo the file.
|
||||
if (! defined ($dayte)) {
|
||||
@ -292,6 +328,7 @@ sub fidelity_nav
|
||||
|
||||
sub fidelity_mm
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
my(@q,%aa,$ua,$url,$sym, $dayte);
|
||||
my %days = ('Monday','Mon','Tuesday','Tue','Wednesday','Wed',
|
||||
'Thursday','Thu','Friday','Fri','Saturday','Sat',
|
||||
@ -304,7 +341,7 @@ sub fidelity_mm
|
||||
$ua->env_proxy();
|
||||
foreach (split('\015?\012',$ua->request(GET $url)->content))
|
||||
{
|
||||
@q = parse_csv($_);
|
||||
@q = _parse_csv($_);
|
||||
|
||||
# extract the date which is usually on the second line fo the file.
|
||||
if (! defined ($dayte)) {
|
||||
@ -331,6 +368,7 @@ sub fidelity_mm
|
||||
|
||||
sub troweprice
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
my(@q,%aa,$ua,$url,$sym);
|
||||
|
||||
# for T Rowe Price, we get them all.
|
||||
@ -340,7 +378,7 @@ sub troweprice
|
||||
$ua->env_proxy();
|
||||
foreach (split('\015?\012',$ua->request(GET $url)->content))
|
||||
{
|
||||
@q = parse_csv($_);
|
||||
@q = _parse_csv($_);
|
||||
|
||||
# extract the date which is usually on the second line fo the file.
|
||||
($sym = $q[0]) =~ s/^ +//;
|
||||
@ -360,6 +398,7 @@ sub troweprice
|
||||
|
||||
sub vanguard
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
# The Vanguard Group doesn't use their ticker symbols to look up funds.
|
||||
# but we do use the ticker symbols. Therefore, we need to do a reverse
|
||||
# lookup. Load the array on first use only
|
||||
@ -540,6 +579,7 @@ sub vanguard
|
||||
# TODO: It's possible to fetch multiple stocks in one operation. It would
|
||||
# be nice to do this, and should not be hard.
|
||||
sub asx {
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
my @stocks = @_;
|
||||
my %info;
|
||||
|
||||
@ -639,6 +679,81 @@ sub asx {
|
||||
}
|
||||
return %info;
|
||||
}
|
||||
# =======================================================================
|
||||
# TIAA-CREF Annuities are not listed on any exchange, unlike their mutual funds
|
||||
# TIAA-CREF provides unit values via a cgi on their website. The cgi returns
|
||||
# a csv file in the format
|
||||
# bogus_symbol1,price1,date1
|
||||
# bogus_symbol2,price2,date2
|
||||
# ..etc.
|
||||
# where bogus_symbol takes on the following values for the various annuities:
|
||||
#
|
||||
#Stock: CREFstok
|
||||
#Money Market: CREFmony
|
||||
#Equity Index: CREFequi
|
||||
#Inf-Linked Bond: CREFinfb
|
||||
#Bond Market: CREFbond
|
||||
#Social Choice: CREFsoci
|
||||
#Global Equities: CREFglob
|
||||
#Growth: CREFgrow
|
||||
#TIAA Real Estate: TIAAreal
|
||||
#PA Stock Index: TIAAsndx
|
||||
#PA Select Stock: TIAAsele
|
||||
|
||||
#
|
||||
# This subroutine was written by Brent Neal <brent@phys.lsu.edu>
|
||||
#
|
||||
# TODO:
|
||||
#
|
||||
# The TIAA-CREF cgi allows you to specify the exact dates for which to retrieve
|
||||
# price data. That functionality could be worked into this subroutine.
|
||||
# Currently, we only grab the most recent price data.
|
||||
#
|
||||
|
||||
sub tiaacref
|
||||
{
|
||||
shift if (ref $_[0]); # Shift off the object if there is one.
|
||||
if (! %tiaacref_ids ) { #build a name hash for the annuities (once only)
|
||||
$tiaacref_ids{"CREFstok"} = "CREF Stock";
|
||||
$tiaacref_ids{"CREFmony"} = "CREF Money Market";
|
||||
$tiaacref_ids{"CREFequi"} = "CREF Equity Index";
|
||||
$tiaacref_ids{"CREFinfb"} = "CREF Inflation-Linked Bond";
|
||||
$tiaacref_ids{"CREFbond"} = "CREF Bond Market";
|
||||
$tiaacref_ids{"CREFsoci"} = "CREF Social Choice";
|
||||
$tiaacref_ids{"CREFglob"} = "CREF Global Equities";
|
||||
$tiaacref_ids{"CREFgrow"} = "CREF Growth";
|
||||
$tiaacref_ids{"TIAAreal"} = "TIAA Real Estate";
|
||||
$tiaacref_ids{"TIAAsndx"} = "TIAA Teachers Personal Annuity Stock Index";
|
||||
$tiaacref_ids{"TIAAsele"} = "TIAA Teachers Personal Annuity Select Stock";
|
||||
}
|
||||
my(@line); #holds the return from _parse_csv
|
||||
my(%info);
|
||||
my($ua,$url); #useragent and target url
|
||||
my($data); #the reply from TIAA-CREF's cgi
|
||||
my(@funds) = @_;
|
||||
|
||||
$url = $TIAACREF_URL;
|
||||
foreach my $fund (@funds) {
|
||||
$url .= $fund . "=yes&";
|
||||
}
|
||||
$url .= "selected=1";
|
||||
|
||||
$ua = LWP::UserAgent->new;
|
||||
$ua->timeout($TIMEOUT) if defined $TIMEOUT;
|
||||
$ua->env_proxy();
|
||||
$data = $ua->request(GET $url)->content;
|
||||
|
||||
foreach (split('\012',$data) ){
|
||||
@line = _parse_csv($_);
|
||||
$info{$line[0],"symbol"} = $line[0]; #in case the caller needs this in the hash
|
||||
$info{$line[0],"exchange"} = "TIAA-CREF";
|
||||
$info{$line[0],"name"} = $tiaacref_ids{$line[0]};
|
||||
$info{$line[0],"date"} = $line[2];
|
||||
$info{$line[0],"nav"} = $line[1];
|
||||
}
|
||||
|
||||
return %info;
|
||||
}
|
||||
|
||||
|
||||
# =======================================================================
|
||||
@ -653,23 +768,25 @@ Finance::Quote - Get stock and mutual fund quotes from various exchanges
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Finance::Quote;
|
||||
$Finance::Quote::TIMEOUT = 60;
|
||||
%quotes = Quote::yahoo @symbols; # Get NYSE quotes from Yahoo
|
||||
%quotes = Quote::yahoo_europe @symbols;# Get Europe quotes from Yahoo France
|
||||
%quotes = Quote::fidelity @symbols; # Get quotes from Fidelity Investments
|
||||
%quotes = Quote::troweprice @symbols; # Get quotes from T. Rowe Price
|
||||
%quotes = Quote::vanguard @symbols; # Get quotes from the Vanguard Group
|
||||
%quotes = Quote::asx @symbols; # Get quotes from the ASX.
|
||||
print ("the last price was ", $quotes {"IBM", "last"} );
|
||||
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(@symbols); # Quotes from T. Rowe Price
|
||||
%quotes = $q->vanguard(@symbols); # Quotes from Vanguard Group
|
||||
%quotes = $q->asx(@symbols); # Australian quotes from ASX.
|
||||
%quotes = $q->tiaacref(@symbols); # Annuities from TIAA-CREF
|
||||
print ("the last price was ", $quotes{"IBM", "last"} );
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module gets stock quotes from various internet sources, including
|
||||
Yahoo! Finance and Fidelity Investments. The B<quote_yahoo> function
|
||||
will return a quote for each of the stock symbols passed to it. The
|
||||
return value of each of the routines is an associative array, which
|
||||
may include one or more of the following elements:
|
||||
Yahoo! Finance and Fidelity Investments. 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
|
||||
@ -696,11 +813,30 @@ may include one or more of the following elements:
|
||||
nav Net Asset Value
|
||||
yeild Yeild (usually 30 day avg)
|
||||
|
||||
(Elements which are not yet implemented have no key associated
|
||||
with them. Not all methods return all keys at all times.)
|
||||
|
||||
You may optionally override the default LWP timeout of 180 seconds by setting
|
||||
$Finance::Quote::TIMEOUT to your preferred value.
|
||||
$quote->timeout() or Finance::Quote::timeout() to your preferred value.
|
||||
|
||||
Note that prices from the Australian Stock Exchange (ASX) are in
|
||||
Australian Dollars.
|
||||
Australian Dollars. Prices from Yahoo! Europe are in euros. All other
|
||||
prices are in US Dollars.
|
||||
|
||||
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
|
||||
|
||||
=head1 FAQ
|
||||
|
||||
@ -727,10 +863,11 @@ the value of the f parameter.
|
||||
|
||||
=head1 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 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
|
||||
@ -742,15 +879,30 @@ by Yahoo! Inc., and is governed by their usage license. See
|
||||
http://www.yahoo.com/docs/info/gen_disclaimer.html for more
|
||||
information.
|
||||
|
||||
=head1 AUTHOR
|
||||
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.
|
||||
|
||||
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>)
|
||||
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.
|
||||
|
||||
=head1 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/
|
||||
|
||||
|
@ -181,6 +181,11 @@ foreach $acct (@acctlist)
|
||||
%quotes = &Quote::asx ($security);
|
||||
$price = $quotes {$security, "last"};
|
||||
}
|
||||
elsif ("TIAACREF" eq $quotesrc)
|
||||
{
|
||||
%quotes = &Quote::tiaacref ($security);
|
||||
$price = $quotes {$security, "nav"};
|
||||
}
|
||||
else
|
||||
{
|
||||
print "unknown quote source: $quotesrc\n";
|
||||
|
@ -73,9 +73,10 @@
|
||||
"/usr/share/guile/1.3a/ice-9/boot-9.scm")))
|
||||
(primitive-load boot-file)))
|
||||
|
||||
;; Automatically generated defaults...
|
||||
;; Automatically generated defaults
|
||||
(define gnc:_config-dir-default_ "@GNC_EXPANDED_CONFIGDIR@")
|
||||
(define gnc:_share-dir-default_ "@GNC_EXPANDED_SHAREDIR@")
|
||||
(define gnc:version "@VERSION@")
|
||||
|
||||
;; These will be converted to config vars later (see prefs.scm)
|
||||
(define gnc:*load-path* #f)
|
||||
|
@ -98,7 +98,10 @@
|
||||
(list (car args) (cdr args)))
|
||||
|
||||
(define (gnc:prefs-show-version)
|
||||
(display "GnuCash 1.3.4 development version") (newline))
|
||||
(display "GnuCash ")
|
||||
(display gnc:version)
|
||||
(display " development version")
|
||||
(newline))
|
||||
|
||||
(define (gnc:prefs-show-usage)
|
||||
(display "usage: gnucash [ option ... ] [ datafile ]") (newline))
|
||||
|
@ -211,8 +211,6 @@
|
||||
"</head>"
|
||||
|
||||
"<body bgcolor=#ccccff>"
|
||||
report-description
|
||||
"<p>"
|
||||
|
||||
"<table cellpadding=1>"
|
||||
"<caption><b>" report-name "</b></caption>"
|
||||
|
Loading…
Reference in New Issue
Block a user