File: getquote

package info (click to toggle)
ledger 2.6.2-3.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,076 kB
  • sloc: cpp: 17,785; sh: 10,246; lisp: 2,167; makefile: 205; python: 53; perl: 11
file content (16 lines) | stat: -rwxr-xr-x 283 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl

$timeout = 60;

use Finance::Quote;

$q = Finance::Quote->new;
$q->timeout($timeout);
$q->require_labels(qw/price/);

%quotes = $q->fetch("nasdaq", $ARGV[0]);
if ($quotes{$ARGV[0], "price"}) {
    print "\$", $quotes{$ARGV[0], "price"}, "\n";
} else {
    exit 1;
}