|
GnuCash 2.4.99
|
00001 #!/usr/bin/perl -w 00002 00003 # get_quotes.pl -- Addition to example Script quotes_historc.py. Reads online stock quotes to file INTC. 00004 # 00005 00006 ## @file 00007 # @brief Addition to example Script quotes_historic.py. Reads online stock quotes to file INTC. 00008 # @author Peter Holtermann 00009 # @date January 2011 00010 # @ingroup python_bindings_examples 00011 # 00012 # Call this script before calling @code 00013 # python quotes_historic.py 00014 # @endcode 00015 # 00016 # For explanation of use have a look at the wiki: 00017 # http://wiki.gnucash.org/wiki/Stocks/get_prices 00018 # 00019 # @cond PERL 00020 00021 use Finance::QuoteHist; 00022 print "Will get stock quotes of $ARGV[0] and save it into the file $ARGV[0]\n"; 00023 $fname = $ARGV[0]; 00024 open (MYFILE, ">$fname"); 00025 $q = Finance::QuoteHist->new 00026 ( 00027 symbols => [($ARGV[0])], 00028 start_date => '01/01/2000', 00029 end_date => 'today', 00030 ); 00031 00032 00033 print "name,date, open, high, low, close, volume\n"; 00034 foreach $row ($q->quotes()) { 00035 ($name,$date, $open, $high, $low, $close, $volume) = @$row; 00036 print MYFILE "$name,$date, $open, $high, $low, $close, $volume\n"; 00037 } 00038 00039 close(MYFILE); 00040 00041 ## @endcond
1.7.4