mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-26 02:40:43 -06:00
Steven Murdoch's patch for using gnc-prices with the London exchange.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2613 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
713894d743
commit
a5997f84b4
1
AUTHORS
1
AUTHORS
@ -84,6 +84,7 @@ Robert Graham Merkel <rgmerk@mira.net> reporting, gnome, and config patches
|
||||
Christopher Molnar <molnarc@mandrakesoft.com> build system patch
|
||||
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
|
||||
Steven Murdoch <sjmurdoch@linuxfan.com> gnc-prices fix for London exchange
|
||||
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
|
||||
|
@ -427,6 +427,10 @@
|
||||
|
||||
<dd>for QIF core dump fix</dd>
|
||||
|
||||
<dt><a href="mailto:sjmurdoch@linuxfan.com">Steven Murdoch</a></dt>
|
||||
|
||||
<dd>gnc-prices fix for London exchange</dd>
|
||||
|
||||
<dt><a href="mailto:brent@baton.phys.lsu.edu">Brent
|
||||
Neal</a></dt>
|
||||
|
||||
|
@ -11,6 +11,10 @@
|
||||
# Created by Linas Vepstas January 1999
|
||||
# Updated by Paul Fenwick <pjf@cpan.org> to take advantage of
|
||||
# new Finance::Quote features. (June 2000)
|
||||
# Updated by Steven Murdoch <sjmurdoch@linuxfan.com> to take
|
||||
# account of London stock prices being quoted in pence
|
||||
# by Yahoo Europe and improve behaviour in the case of no
|
||||
# Internet connection (July 2000)
|
||||
#
|
||||
# Copyright (c) 1999-2000 Linas Vepstas
|
||||
|
||||
@ -163,25 +167,41 @@ foreach $acct (@acctlist)
|
||||
|
||||
undef $price; # undef to make sure later if($price) not broken
|
||||
|
||||
%quotes = &Quote::fetch($quotesrc, $security);
|
||||
unless ($quotes{$security,'success'})
|
||||
# assign to a list, beacuse if fetch fails assignment
|
||||
# to a hash will raise a warning, as it will return a one
|
||||
# element list. where the first element is undef
|
||||
@quotes_list = &Quote::fetch($quotesrc, $security);
|
||||
|
||||
# if and only if there really is information then assign to the hash
|
||||
%quotes = @quotes_list if $quotes_list[0];
|
||||
|
||||
# the fetch is OK if and only if information is returned AND
|
||||
# it is maked as a success
|
||||
# The first condition is needed becasue if no information
|
||||
# returned then %quotes is uninitialized and perl will raise a warning
|
||||
unless ($quotes_list[0] && $quotes{$security,'success'})
|
||||
{
|
||||
print "Lookup of $quotesrc/$security failed: ",
|
||||
$quotes{$security,'errormsg'}."\n";
|
||||
next;
|
||||
print "Lookup of $quotesrc/$security failed";
|
||||
# Show the error if and only if there is an error message
|
||||
print ": $quotes{$security,'errormsg'}" if ($quotes{$security,'errormsg'});
|
||||
print "\n";
|
||||
next;
|
||||
}
|
||||
|
||||
print "using $quotesrc\n";
|
||||
|
||||
$price = $quotes{$security,'price'};
|
||||
|
||||
print "using $quotesrc\n";
|
||||
print "$name: ";
|
||||
|
||||
$dayte = $quotes {$security, "date"};
|
||||
$prodname = $quotes {$security, "name"};
|
||||
|
||||
if ($price)
|
||||
{
|
||||
print "$security $prodname last price = $price at $dayte\n";
|
||||
# if and only if the price is served by Yahoo Europe AND is dealt on
|
||||
# the London stock market then the price will be given in pence. So to
|
||||
# convert this into GBP divide the price by 100 before storing the new price.
|
||||
$price/=100 if (($security=~/.L$/i) && ($quotesrc eq 'YAHOO_EUROPE'));
|
||||
|
||||
print "$name: $security $prodname last price = $price at $dayte\n";
|
||||
# This || construction will store the price if its not already
|
||||
# stored (in the 28 hour period surrounding "dayte")
|
||||
&checkprice ($acct, $dayte, $price) ||
|
||||
|
Loading…
Reference in New Issue
Block a user