23:25 >perl 1001_SoPW.pl
Price of GOOGL is 597.78 for 09/05/2014
23:25 >
####
use strict;
use warnings;
use Finance::Quote;
getquote('googl', '20140822');
sub getquote
{
my ($sym, $qdate) = @_;
$sym = uc($sym);
my $quote = Finance::Quote->new;
my @exchanges = sort($quote->sources);
$quote->timeout(60);
$quote->require_labels(qw/price date high low volume/);
$quote->set_currency('USD');
my $exch = 'usa';
my %info = $quote->fetch($exch, $sym, 'A', 'MSFT');
if (!%info)
{
my $s = "getquote ERROR: No information returned for symbol $sym from $exch";
warn $s;
return;
}
my $dt = $info{$sym, 'date'};
print "Price of $sym is " . $info{$sym, 'price'} . ' for ' . $dt . "\n"; # DEBUG
}
####
$quote->require_labels(qw/success errormsg price date exchange name/);
####
$quote->require_labels(qw/price date high low volume/);