[Fwd: Patch for Finance::Quote::Yahoo::Base.pm]

Linas Vepstas linas at linas.org
Thu Nov 6 13:49:29 CST 2003


Ugh,

<flame on>
Reading mail like this makes me go ballistic.  In the name of the devil,
why would anyone fork this project?

F::Q handles over a dozen quote sources, not just yahoo.  This is because
Yahoo lacks many of the more important financial data; it seems to be
concentrated mostly on stocks and specifically on stocks traded on the NYSE. 

GnuCash uses F::Q so that it can get data from these other sources as well.
I *strongly* encourage everyone involved to merge these 'new/improved'
features and bug fixes in F::YQ back into F::Q so that we can support 
one programming interface instead of a dozen. 

</flame off>


--linas


On Wed, Oct 15, 2003 at 01:11:28PM -0500, Dirk Eddelbuettel was heard to remark:
> 
> Jason,
> 
> As Dj states, I am the current maintainer for the Finance::YahooQuote module
> he created -- given that I have also been maintaining it for Debian for
> several years now, and continue rely on it for data acquisition in my own
> smtm and beancounter projects (which you can find on CPAN, in Debian or on
> my own site).
> 
> I am somewhat unsure why you emailed Dj given that problem is/was with the
> unrelated (though covering similar functionality) Finance::Quote module.
> 
> In any case, as you can see below from using the example yahooquote frontend
> script, F::YQ also does what you dislike in F::Q (and allow me to add that
> F::YQ can now retrieve many more fields from Yahoo, incl. real-time ones,
> which have not been reflected in the example frontend yahooquote used here).
> 
> You will need to assess if it covers your other needs. Adding another layer
> which replaces the returned symbol with the initial symbol should be
> straightforward.  
> 
> If you have further questions, please feel free to ask me directly.
> 
> Best regards, Dirk
> 
> edd at chibud:~> yahooquote --verbose pfe
> Symbol: PFE
> Name: PFIZER INC
> Last: 30.68
> Trade Date: 10/15/2003
> Trade Time: 1:37pm
> Change: -0.20
> % Change: -0.65%
> Volume: 12201700
> Avg. Daily Volume: 19174863
> Bid: N/A
> Ask: N/A
> Prev. Close: 30.88
> Open: 30.88
> Day's Range: 30.61 - 30.95
> 52-Week Range: 27.90 - 36.92
> EPS: 0.62
> P/E Ratio: 49.81
> Div. Pay Date: Sep  4
> Div/Share: 0.60
> Div. Yield: 1.94
> Mkt. Cap: 238.9B
> Exchange: NYSE
> 
> 
> For reference, this from the most recent 0.20 version of Finance::YahooQuote
> as packaged in Debian's libfinance-yahooquote-perl:
> 
> edd at chibud:~> dpkg -l libfinance-yahooquote-perl
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
> |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err:
> uppercase=bad)
> ||/ Name                                Version
> Description
> +++-===================================-===================================-======================================================================================
> ii  libfinance-yahooquote-perl          0.20
> Perl module for retrieving stock quotes from Yahoo! Finance
> edd at chibud:~> dpkg -L libfinance-yahooquote-perl
> /.
> /usr
> /usr/lib
> /usr/lib/perl5
> /usr/share
> /usr/share/perl5
> /usr/share/perl5/Finance
> /usr/share/perl5/Finance/YahooQuote.pm
> /usr/share/man
> /usr/share/man/man1
> /usr/share/man/man1/yahooquote.1p.gz
> /usr/share/man/man3
> /usr/share/man/man3/Finance::YahooQuote.3pm.gz
> /usr/share/doc
> /usr/share/doc/libfinance-yahooquote-perl
> /usr/share/doc/libfinance-yahooquote-perl/README
> /usr/share/doc/libfinance-yahooquote-perl/CHANGES.old
> /usr/share/doc/libfinance-yahooquote-perl/copyright
> /usr/share/doc/libfinance-yahooquote-perl/examples
> /usr/share/doc/libfinance-yahooquote-perl/examples/examine_server.sh
> /usr/share/doc/libfinance-yahooquote-perl/examples/symbol_alias.sh
> /usr/share/doc/libfinance-yahooquote-perl/changelog.gz
> /usr/bin
> /usr/bin/yahooquote
> 
> 
> 
> 
> 
> On Wed, Oct 15, 2003 at 10:12:50AM -0700, Dj Padzensky wrote:
> > 
> > Unfortunately, you missed the person who's actually maintaining the 
> > code :-)
> > 
> > Dirk is the official maintainer of the F::YQ code now.  Please direct 
> > your questions to him.
> > 
> > Thanks!
> > 
> > --Dj
> > 
> > 
> > Begin forwarded message:
> > 
> > >From: "Jason A. Pattie" <pattieja at pcxperience.com>
> > >Date: Wed Oct 15, 2003  9:38:37 AM US/Pacific
> > >To: "Dj Padzensky" <djpadz at padz.net>, "Linas Vepstas" 
> > ><linas at linas.org>, "Yannick LE NY" <y-le-ny at ifrance.com>, "Paul 
> > >Fenwick" <pjf at cpan.org>, "Brent Neal" <brentn at users.sourceforge.net>
> > >Subject: [Fwd: Patch for Finance::Quote::Yahoo::Base.pm]
> > >X-Sf-Sender: <pattieja at pcxperience.com>
> > >
> > >-----BEGIN PGP SIGNED MESSAGE-----
> > >Hash: SHA1
> > >
> > >I have not received a response to my original e-mail, so I am resending
> > >it in the hopes that it will reach the right people.
> > >
> > >If this project is dead or not being updated any longer, would it be
> > >possible to host our own version of the module, since we will continue
> > >to need to use it and modify it, especially as the different brokerage
> > >firms' websites update their parameters, etc.?
> > >
> > >Thank you.
> > >
> > >- -------- Original Message --------
> > >Subject: Patch for Finance::Quote::Yahoo::Base.pm
> > >Date: Fri, 22 Aug 2003 14:53:40 -0500
> > >From: Jason A. Pattie <pattieja at pcxperience.com>
> > >To: Paul Fenwick <pjf at cpan.org>
> > >
> > >Hello.
> > >
> > >I've run into a situation where we use Finance::Quote at work for a
> > >project to lookup stock prices from Yahoo! Finance and chose to use 
> > >your
> > >solution to this problem.  We had previously been downloading and
> > >parsing the .csv files ourselves and grabbing the data but wanted a 
> > >more
> > >abstracted approach to increase the ease of programming, and to be able
> > >to pull from multiple sources, etc.  One thing that I've noticed is 
> > >that
> > >the ticker symbols that are sent to Finance::Quote (in particular the
> > >Yahoo! fetch method, since I haven't used any other -- not currently a
> > >need to, yet) are modified -- always.  The "case" of the returned 
> > >symbol
> > >comes from Yahoo! and is not the original that I sent to it.  So, for
> > >example, if I send 'pfe' (to lookup Pfizer Inc. data) to the fetch
> > >method, the returned symbol from Yahoo! Finance will be 'PFE'.
> > >Finance::Quote, in my opinion, does not handle this correctly and
> > >changes the ticker symbol in the %info hash to 'PFE' instead of
> > >returning 'pfe' as I passed in.  This has basically made it impossible
> > >to determine from the original list of "case"-sensitive symbols that I
> > >sent to Finance::Quote which failed and which did not and that some 
> > >were
> > >failing when they actually, really succeeded.  I modified the
> > >Finance::Quote::Yahoo::Base.pm module to make it so that the symbol 
> > >that
> > >was used to lookup the data is the one used by the %info hash and not
> > >the returned symbol from Yahoo! Finance.
> > >
> > >This may or may not be the functionality that you desire.  If not, I
> > >haven't come across a good way to efficiently search case-insensitively
> > >against the %info hash for my original value so that 'pfe' would match
> > >'PFE' (or 'tapa' would match 'TAPa', for example; obviously, not
> > >everything comes back all uppercase, just most things).
> > >
> > >Thank you very much.
> > >(I hope I'm sending this to the correct person.  I saw a huge list of
> > >maintainers in the code, and you were second from the bottom of the 
> > >list
> > >of most recent).
> > >
> > >- --
> > >Jason A. Pattie
> > >pattieja at xperienceinc.com
> > >Xperience, Inc. (http://www.xperienceinc.com)
> > >
> > >
> > >- --
> > >Jason A. Pattie
> > >pattieja at xperienceinc.com
> > >Xperience, Inc. (http://www.xperienceinc.com)
> > >-----BEGIN PGP SIGNATURE-----
> > >Version: GnuPG v1.2.3 (GNU/Linux)
> > >Comment: Using GnuPG with Debian - http://enigmail.mozdev.org
> > >
> > >iD8DBQE/jXgNuYsUrHkpYtARAvIAAJ9g4c6U8Ms3ECqrex8g63cMaTDEnACfUW7c
> > >Y+oVUf8dnOpq6DnAT9oa2zw=
> > >=HOmJ
> > >-----END PGP SIGNATURE-----
> > >
> > >-- 
> > >This message has been scanned for viruses and
> > >dangerous content by MailScanner, and is
> > >believed to be clean.
> > >Mailscanner thanks transtec Computers for their support.
> > >
> > >--- Base_old.pm	2003-08-22 14:29:55.000000000 -0500
> > >+++ Base_new.pm	2003-08-22 14:22:14.000000000 -0500
> > >@@ -147,6 +147,13 @@
> > > 	# The suffix is used to specify particular markets.
> > > 	my $suffix = shift || "";
> > >
> > >+	# create an index by using a hash to lookup tickers 
> > >case-insensitively
> > >+	my %lookuphash = ();
> > >+	foreach my $orig_symbol (@orig_symbols)
> > >+	{
> > >+	  $lookuphash{lc("$orig_symbol")} = $orig_symbol;
> > >+	}
> > >+	
> > > 	my %info;
> > > 	my $ua = $quoter->user_agent;
> > >
> > >@@ -177,6 +184,8 @@
> > > 			# Strip out suffixes.  Mmmm, functions as lvalues.
> > > 			substr($symbol,-length($suffix),length($suffix)) = 
> > > 			"";
> > >
> > >+			$symbol = $lookuphash{lc("$symbol")};
> > >+
> > > 			# If we weren't using a two dimesonal
> > > 			# hash, we could do the following with
> > > 			# a hash-slice.  Alas, we can't.  This just
> > >
> 
> 
> 
> -- 
> Those are my principles, and if you don't like them... well, I have others.
>                                                 -- Groucho Marx

-- 
pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas at linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933


More information about the gnucash-devel mailing list