pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Something better than www/urlget ?

On Wed, Jul 13, 2016 at 03:54:10PM +0800, Paul Goyette wrote:
> i can get the quotes, but not the dividend info. quotes are still available
> via csv file.
> not sure how to call perl module from shell script.

I've written a simple perl script to get the price and dividends, see

The 'Dumper' line is to show what is available, the print lines show
how to get single values.

Obviously, you need to install finance/p5-Finance-Quote.

Hope this helps,
#!/usr/bin/env perl
use Finance::Quote;
use Data::Dumper;
$q = Finance::Quote->new;


$q->set_currency("USD");  # Return all info in dollars.

$q->require_labels(qw/price date high low volume/);

%info = $q->fetch("usa","AAPL");

print "The price of AAPL is ".$info{"AAPL","price"}."\n";
print "The dividends for AAPL are ".$info{"AAPL","div"}."\n";

Home | Main Index | Thread Index | Old Index