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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.