Last active
December 23, 2015 23:29
-
-
Save keedi/6710221 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# http://cafe.naver.com/perlstudy/2148 | |
# | |
use v5.14; | |
use utf8; | |
use strict; | |
use warnings; | |
use Finance::QuoteHist::Yahoo; | |
local $| = 1; | |
die "Usage: $0 <stock file>\n" unless @ARGV == 1; | |
my $file = shift; | |
open my $fh, $file or die "cannot open $file file: $!\n"; | |
while ( my $stock = <$fh> ) { | |
chomp $stock; | |
my $q = Finance::QuoteHist::Yahoo->new( | |
symbols => $stock, | |
start_date => '01/01/1960', | |
end_date => 'today', | |
); | |
for my $row ( $q->quotes ) { | |
my ( $symbol, $date, $open, $high, $low, $close, $volume, $adj ) = @$row; | |
say "$date $open $high $low $close $volume $adj"; | |
} | |
} | |
close $fh; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment