sub getquote {my($sym,$qdate)=@_; # Symbol is 'googl' in lowercase and date is '20140822'. 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","Tiaacref"); $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"; # DEBUG return; # getquote }