bulrush has asked for the wisdom of the Perl Monks concerning the following question:
Here's my subroutine.
Right after the $quote->fetch I do at the debugger prompt "print Dumper(\%info)" and I get this: "$VAR1 = {};" which indicates the hash has nothing in it.sub getquote {my($sym,$qdate)=@_; # Symbol is 'googl' in lowercase and date is '201 +40822'. my($dt,$quote,$s,$t,$procname,$exch); my(%info,@exchanges); $procname="getquote"; $sym=uc($sym); # First qet quote. # Do not load Yahoo::Base. #$quote=Finance::Quote->new("-defaults","Fidelity","Yahoo::USA","Tiaac +ref"); $quote=Finance::Quote->new; # Loads 116 default exchanges. @exchanges=sort($quote->sources); # See all exchanges here. $quote->timeout(60); $quote->require_labels(qw/success errormsg price date exchange name/); $quote->set_currency("USD"); $exch="usa"; %info=$quote->fetch($exch,$sym,'A','MSFT'); if (! %info) { $s="$procname ERROR: No information returned for symbol $sym from +$exch"; writeerr($s); return; # getquote() } $dt=$info{$sym,'date'}; print "Price of $sym is ".$info{$sym,'price'}." for ".$dt."\n"; # DEBU +G return; # getquote }
Thanks.
has invalid labels but F::Q doesn't give an error msg. So this line works:$quote->require_labels(qw/success errormsg price date exchange name/);
I can also remove the above line and F::Q still returns all data it can about the equity. F::Q really needs better error checking, but I think I have to have an account to file a bug report.$quote->require_labels(qw/price date exchange name/);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finance::Quote returns nothing and no error
by Athanasius (Archbishop) on Sep 06, 2014 at 13:32 UTC | |
by pshen (Initiate) on Oct 11, 2018 at 07:29 UTC | |
by poj (Abbot) on Oct 11, 2018 at 13:15 UTC |