*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2132 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-03-30 00:49:54 +00:00
parent 18ef8bb39d
commit 7c60889ad1
8 changed files with 157 additions and 94 deletions

View File

@ -176,7 +176,7 @@
he re-wrote it: adding cell-widgets to XbaeMatrix, so that
the combobox and arrows would make an even slicker GUI,
rewrote the X-Accountant internals to add double-entry, an
account heirarchy, split out a transaction mini-engine, add
account hierarchy, split out a transaction mini-engine, add
support for stocks, and spiff up the help menus. This was
version 1.0 as of January 1998. Since then, for version 1.1,
the engine was expanded and refined, and the register window
@ -286,6 +286,10 @@
<dd>for budgeting design notes</dd>
<dt> <a href="mailto:pjf@schools.net.au"> Paul Fenwick</a></dt>
<dd>ASX support</dd>
<dt> <a href="mailto:ju_finck@mail.netwave.de"> Jan-Uwe
Finck</a></dt>

86
Gnucash
View File

@ -1,86 +0,0 @@
! /********************************************************************\
! * Gnucash -- X11 resources for gnucash *
! * Copyright (C) 1997 Robin D. Clark *
! * *
! * 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. *
! * *
! * This program is distributed in the hope that it will be useful, *
! * but WITHOUT ANY WARRANTY; without even the implied warranty of *
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! * 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. *
! * *
! * Author: Rob Clark *
! * Internet: rclark@cs.hmc.edu *
! * Address: 609 8th Street *
! * Huntington Beach, CA 92648-4632 *
! \********************************************************************/
Xacc*Foreground: black
gnucash*Background: grey
gnucash*fontList: -*-helvetica-bold-r-normal--*-120-*-*-*-*-*-*
gnucash*text.fontList: -*-helvetica-medium-r-normal--*-100-*-*-*-*-*-*
! Help stuff:
gnucash*help*geometry: 530x480-0-0
! gnucash*help*View*Background: #ffffff
!
! MenuBar stuff:
gnucash*menubar*marginHeight: 1
gnucash*menubar*marginWidth: 1
! Register window account type specific stuff:
gnucash*regbank.oddRowBackground: #aaccff
gnucash*regcash.oddRowBackground: #ccffcc
gnucash*regasset.oddRowBackground: #aaffcc
gnucash*regcredit.oddRowBackground: #ffffaa
gnucash*regliability.oddRowBackground: #ffcccc
gnucash*regportfolio.oddRowBackground: #ccffff
gnucash*regmutual.oddRowBackground: #ccffff
gnucash*regincome.oddRowBackground: #aaccff
gnucash*regexpense.oddRowBackground: #ffcccc
gnucash*regequity.oddRowBackground: #ffffaa
gnucash*regportfolio.evenRowBackground:grey
gnucash*regmutual.evenRowBackground: grey
! pop-down box (combobox stuff)
! combobox -- don't want the cell to be outlined
gnucash*reg*popbox*shadowThickness: 0
! we *do* want the combobox scroll bar to show, thoguh
gnucash*reg*popbox*list*shadowThickness: 1
! slider width ignored ... why ???
gnucash*reg*popbox*list*thickness: 24
gnucash*reg*popbox*list*VertScrollBar*width: 24
! Other register window account stuff:
gnucash*reg*fontList: -*-helvetica-medium-r-normal--*-100-*-*-*-*-*-*
gnucash*reg*evenRowBackground: white
gnucash*reg*shadowType: SHADOW_IN
gnucash*reg*shadowThickness: 1
gnucash*reg*cellShadowThickness: 1
gnucash*reg*cellShadowType: SHADOW_IN
gnucash*reg*cellMarginWidth: 1
gnucash*reg*cellMarginHeight: 0
! Reconcile window matrices stuff:
gnucash*recn*fontList: -*-helvetica-medium-r-normal--*-100-*-*-*-*-*-*
gnucash*recn*.oddRowBackground: white
gnucash*recn*.evenRowBackground: white
gnucash*recn*shadowType: SHADOW_ETCHED_IN
gnucash*recn*shadowThickness: 1
gnucash*recn*cellShadowThickness: 1
gnucash*recn*cellShadowType: SHADOW_ETCHED_IN
gnucash*recn*cellMarginWidth: 0
gnucash*recn*cellMarginHeight: 0

7
README
View File

@ -544,15 +544,16 @@ Albert Chin-A-Young <china@thewrittenword.com> configure.in patch
Jeremey Collins <jcollins@gnucash.org> for GnoMoney & GTK port
Patrick Condron <pcondon@rackspace.com> for webserver and T1 connection.
Ciaran Deignan <Ciaran.Deignan@bull.net> for AIX binary version
Tyson Dowd <tyson@tyse.net> for config/make patches & debian maint.
Tyson Dowd <tyson@tyse.net> for config/make patches & debian maint
Koen D'Hondt <ripley@xs4all.nl> for Solaris patches to XmHTML
Bob Drzyzgula <bob@mostly.com> for budgeting design notes
Paul Fenwick <pjf@schools.net.au> ASX support
Jan-Uwe Finck <ju_finck@mail.netwave.de> for German message translation
Ron Forrester <rjf@aracnet.com> for gnome patches
Dave Freese <DFreese@osc.uscg.mil> for leap-year fix
Bill Gribble <grib@billgribble.com> qif importation code
Otto Hammersmith <otto@bug.redhat.com> for RedHat RPM version
Alexandru Harsanyi <haral@codec.ro> for core dumps, lockups, gtk work.
Alexandru Harsanyi <haral@codec.ro> for core dumps, lockups, gtk work
Jon K}re Hellan <jk@isdn-a33.itea.ntnu.no> misc core dump fixes
Prakash Kailasa <PrakashK@bigfoot.com> for gnome build fixes
Ben Kelly <ben.kelly@ieee.org> for motif menu bug fix, core dump fixes
@ -565,7 +566,7 @@ Yannick Le Ny <y-le-ny@ifrance.com> pour la traduction en francais
Grant Likely <glikely@nortelnetworks.com> gnome and engine patches
Heath Martin <martinh@pegasus.cc.ucf.edu> gnome patches, major register work
Matt Martin <mgmartin@abacusnet.net> guile error handling code
Robert Graham Merkel <rgmerk@mira.net> reporting, gnome, and config patches.
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
Peter Norton <spacey@inch.com> for a valiant attempt at a GTK port

View File

@ -201,6 +201,8 @@ gnc_get_source_name(gint source)
return "T. Rowe Price";
case SOURCE_VANGUARD :
return "Vanguard";
case SOURCE_ASX :
return "ASX";
}
PWARN("Unknown source");
@ -225,6 +227,8 @@ gnc_get_source_code_name(gint source)
return "TRPRICE";
case SOURCE_VANGUARD :
return "VANGUARD";
case SOURCE_ASX :
return "ASX";
}
PWARN("Unknown source");

View File

@ -64,6 +64,7 @@ enum
SOURCE_FIDELITY,
SOURCE_TROWEPRICE,
SOURCE_VANGUARD,
SOURCE_ASX,
NUM_SOURCES
};

View File

@ -3,6 +3,7 @@
# 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, Paul Fenwick <pjf@schools.net.au>
#
# 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
@ -33,12 +34,13 @@ use vars qw($VERSION @EXPORT @ISA $TIMEOUT
$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);
$VANGUARD_QUERY_URL $VANGUARD_CSV_URL @vanguard_ids
$ASX_URL);
use LWP::UserAgent;
use HTTP::Request::Common;
$VERSION = '0.13';
$VERSION = '0.14';
@ISA = qw(Exporter);
$YAHOO_URL = ("http://quote.yahoo.com/d?f=snl1d1t1c1p2va2bapomwerr1dyj1&s=");
@ -52,6 +54,7 @@ $FIDELITY_ASSET_URL = ("http://personal441.fidelity.com/gen/prices/asset.csv");
$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);
@ -527,6 +530,117 @@ sub vanguard
return %aa;
}
# =======================================================================
# Australian Stock Exchange (ASX)
# The ASX provides free delayed quotes through their webpage.
#
# Maintainer of this section is Paul Fenwick <pjf@schools.net.au>
#
# 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 {
my @stocks = @_;
my %info;
my $ua = LWP::UserAgent->new;
$ua->timeout($TIMEOUT) if defined $TIMEOUT;
$ua->env_proxy();
foreach my $stock (@stocks) {
my $reply = $ua->request(GET $ASX_URL.$stock)->content;
# Grab the date. This is a pretty clunky way of doing it, but
# my mind's still in brain-saver mode.
my ($day, $month, $year) = $reply =~ /(\d\d?) (January|February|March|April|May|June|July|August|September|October|November|December) (\d{4})/;
$_ = $month;
(s/January/1/ or
s/February/2/ or
s/March/3/ or
s/April/4/ or
s/May/5/ or
s/June/6/ or
s/July/7/ or
s/August/8/ or
s/September/9/ or
s/October/10/ or
s/November/11/ or
s/December/12/ or (warn "Bizzare month $_ from ASX. Skipped $stock\n"
and return undef));
$info{$stock,"date"} = "$_/$day/$year"; # Silly 'merkin format.
# These first two steps aren't really needed, but are done for
# safety.
# Remove the bottom part of the page.
$reply =~ s#</table>\s*\n<table>.*$##s;
# Remove top of page.
$reply =~ s#.*<table##s;
# Now pluck out the headings.
my @headings;
while ($reply =~ m#<FONT +SIZE=2><B>([%\w ]*).*?</B>#g) {
push @headings, $1;
}
# Now grab the values
my @values;
while ($reply =~ m#<td align=(left|right)><Font Size=2>(.*?)</Font>#g) {
push @values, $2;
}
# Put the two together and we get shares information.
foreach my $heading (@headings) {
my $value = shift @values;
# Check the code that we got back.
if ($heading =~ /ASX CODE/) {
if ($value ne $stock) {
# Oops! We got back a stock that we didn't want?
warn "Bad stocks returned from the ASX. ".
"Wanted $stock but got $value.";
return undef;
}
next;
}
# Convert ASX headings to labels we want to return.
$_ = $heading;
(s/LAST/last/) or
(s/BID/bid/) or
(s/OFFER/ask/) or
(s/OPEN/open/) or
(s/HIGH/high/) or
(s/LOW/low/) or
(s/LAST/last/) or
(s/PDC/close/) or
(s/%/p_change/) or
(s/VOLUME/volume/) or (warn "Unknown heading from ASX: $_. Skipped"
and next);
# Clean the value
$value =~ tr/$,%//d;
# If the value if nbsp then skip it. Some things are not
# defined outside trading hours.
next if $value =~ /&nbsp;/;
# Put the info into our hash.
$info{$stock,$_} = $value;
}
$info{$stock,"name"} = $stock; # ASX doesn't give names. :(
# Outside of business hours, the last price is the same as the
# previous day's close.
$info{$stock,"last"} ||= $info{$stock,"close"};
}
return %info;
}
# =======================================================================
1;
@ -546,6 +660,7 @@ Finance::Quote - Get stock and mutual fund quotes from various exchanges
%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"} );
=head1 DESCRIPTION
@ -558,10 +673,12 @@ 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
Change
Percent Change
p_change Percent Change from previous day's close
volume Volume
Average Daily Vol
bid Bid
@ -582,6 +699,9 @@ may include one or more of the following elements:
You may optionally override the default LWP timeout of 180 seconds by setting
$Finance::Quote::TIMEOUT to your preferred value.
Note that prices from the Australian Stock Exchange (ASX) are in
Australian Dollars.
=head1 FAQ
If there's one question I get asked over and over again, it's how did
@ -610,6 +730,7 @@ the value of the f parameter.
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)
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
@ -626,6 +747,7 @@ 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 Finance::YahooQuote home page can be found at
http://www.padz.net/~djpadz/YahooQuote/

View File

@ -63,3 +63,12 @@ print "\n\n";
# -----------------------------------
# demo for ASX. Grab the price of Coles-Myer and Telstra
@funds = ("CML","TLS");
%quotes = Quote::asx(@funds);
foreach $f (@funds) {
print "ASX Price of $f is ".$quotes{$f,"last"}." at ".
$quotes{$f,"date"}."\n";
}
print "\n\n";

View File

@ -11,8 +11,11 @@
# Created by Linas Vepstas January 1999
# Copyright (c) 1999-2000 Linas Vepstas
# hack alert -- this pathname should *NOT* be hard-coded.
# hack alert -- this pathname should *NOT* be hard-coded, nor should the
# ones below it.
use lib '/usr/lib/gnucash';
use lib '/usr/local/lib/gnucash';
use lib '/opt/gnucash/lib/gnucash';
use Quote;
use gnucash;
@ -174,6 +177,11 @@ foreach $acct (@acctlist)
%quotes = &Quote::vanguard ($security);
$price = $quotes {$security, "nav"};
}
elsif ("ASX" eq $quotesrc)
{
%quotes = &Quote::asx ($security);
$price = $quotes {$security, "last"};
}
else
{
print "unknown quote source: $quotesrc\n";