Hello bulrush,
By making some changes to your code I was able to get this result (running from the command line under Windows 8.1):
23:25 >perl 1001_SoPW.pl Price of GOOGL is 597.78 for 09/05/2014 23:25 >
Here is my revised script:
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 $s +ym from $exch"; warn $s; return; } my $dt = $info{$sym, 'date'}; print "Price of $sym is " . $info{$sym, 'price'} . ' for ' . $dt . + "\n"; # DEBUG }
The major change is to the line:
$quote->require_labels(qw/success errormsg price date exchange name/);
which I replaced with this line:
$quote->require_labels(qw/price date high low volume/);
copied from the “SYNOPSIS” section of the module’s documentation. I conclude that the module works, you just need to tweak the label settings.
BTW: Please note that Perl variables are best declared at the point of first use. Also, the second parameter to sub getquote is unused.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Finance::Quote returns nothing and no error
by Athanasius
in thread Finance::Quote returns nothing and no error
by bulrush
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |