in reply to Re: Finance::Quote returns nothing and no error
in thread Finance::Quote returns nothing and no error

Hi Athanasius, I tried running your code on windows 7 enterprise (64 bit) but its not able to get the data. Please see below the output.
C:\strawberryPerl\scripts>perl getStockPrice2.pl getquote ERROR: No information returned for symbol GOOGL from usa at g +etStockPri ce2.pl line 24. C:\strawberryPerl\scripts>
Here is the code (same as yours)
use strict; use warnings; use Finance::Quote; getquote('googl', '20140822'); my $s; 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) { $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 }

Replies are listed 'Best First'.
Re^3: Finance::Quote returns nothing and no error
by poj (Abbot) on Oct 11, 2018 at 13:15 UTC

    Looks like the API was terminated last year. Also see Finance::YahooQuote which now says

    NOTE: As of November 2017, the module is no longer all that useful as Yahoo! decided to halt the API service it relies on.

    Some info is available using yahoo_json if you have a recent version of Finance::Quote

    use strict; use warnings; use Finance::Quote; use Data::Dumper; printf "Version : %s\n", $Finance::Quote::VERSION; my $q = Finance::Quote->new(); $q->timeout(60); $q->set_currency("USD"); my $stock = 'googl'; my $info = $q->fetch("yahoo_json",$stock); print Dumper $info; printf "Latest price for %s is %s", $info->{$stock,'name'},$info->{$st +ock,'last'};
    poj