summaryrefslogtreecommitdiff
path: root/contrib/getquote.pl
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-24 02:44:07 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-24 02:44:07 +0100
commit440124eacc9f7fde993e87968ca9e65ffa309f11 (patch)
treec86839186bee5c4951ad98491d02625e9c276669 /contrib/getquote.pl
parent72a2eaa38e68b886a567da2afda8f08b1929e3b6 (diff)
downloadfork-ledger-440124eacc9f7fde993e87968ca9e65ffa309f11.tar.gz
fork-ledger-440124eacc9f7fde993e87968ca9e65ffa309f11.tar.bz2
fork-ledger-440124eacc9f7fde993e87968ca9e65ffa309f11.zip
Restored --download, although not done yet
The problem at this point is that it's recording prices in the price database multiple times; it should only need to download a price for each commodity once per day.
Diffstat (limited to 'contrib/getquote.pl')
-rwxr-xr-xcontrib/getquote.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/getquote.pl b/contrib/getquote.pl
index bed561d6..8e3bb678 100755
--- a/contrib/getquote.pl
+++ b/contrib/getquote.pl
@@ -1,8 +1,9 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
$timeout = 60;
use Finance::Quote;
+use POSIX qw(strftime localtime time);
$q = Finance::Quote->new;
$q->timeout($timeout);
@@ -10,6 +11,8 @@ $q->require_labels(qw/price/);
%quotes = $q->fetch("nasdaq", $ARGV[0]);
if ($quotes{$ARGV[0], "price"}) {
+ print strftime('%Y/%m/%d %H:%M:%S', localtime(time()));
+ print " ", $ARGV[0], " ";
print "\$", $quotes{$ARGV[0], "price"}, "\n";
} else {
exit 1;