[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] Are There Better ways to do this.



At 8:37 PM -0400 6/29/99, Dennis Krystowiak wrote:
>I want to extract stock quotes into a file so I can move this list into some
>other document or speadsheet with cut or paste.  This is what I have come up
>with.  I picked snap.com because it gives fairly concise quotes without a
>lot of background to filter out.  Is there and easier or better way to do
>this?

Take a look at <http://www.padz.net/~djpadz/YahooQuote/>.  (This 
is also available somewhere on CPAN.) 

I'm not sure exactly what your script is writing to the PRICES file,
but if it is supposed to be just the latest price, then the following
should  do the job:

#! perl -w

use Finance::YahooQuote;

@mystocks = ("ABT","AMAT","BA","HB","LU","MCT","SYBS");

@mymf = ("TRBCX","KAUFX","BESCX","TWCUX","VFINX","FMAGX","KAUFX","NBGNX");

open (OUT, "> PRICES") || die;

print OUT map { "$_->[2]\n" } getquote(@mystocks);
print OUT "\n--------\n";   #mutal fund divider
print OUT map { "$_->[2]\n" } getquote(@mymf);

close(OUT) || die;

__END__

Oh, by the way, @mystocks is missing "AAPL"! 

:-)

Jim
--
Jim Miner          jfm@winternet.com

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org