GnuCash  5.6-150-g038405b370+
get_quotes.pl
Go to the documentation of this file.
1 #!/usr/bin/perl -w
2 
3 # get_quotes.pl -- Addition to example Script quotes_historc.py. Reads online stock quotes to file INTC.
4 #
5 
6 
20 
21 use Finance::QuoteHist;
22 print "Will get stock quotes of $ARGV[0] and save it into the file $ARGV[0]\n";
23 $fname = $ARGV[0];
24  open (MYFILE, ">$fname");
25  $q = Finance::QuoteHist->new
26  (
27  symbols => [($ARGV[0])],
28  start_date => '01/01/2000',
29  end_date => 'today',
30  );
31 
32 
33 print "name,date, open, high, low, close, volume\n";
34 foreach $row ($q->quotes()) {
35  ($name,$date, $open, $high, $low, $close, $volume) = @$row;
36  print MYFILE "$name,$date, $open, $high, $low, $close, $volume\n";
37  }
38 
39 close(MYFILE);
40 
41