Finance::QuoteHist::Yahoo is perfect ... and very fast ... Thank you very much. I was dreading the thought of using LWP::Simple for all of this... Now I just find an Excel (like) formula module and I'll be dangerous... Thanks again.
#!/usr/bin/perl
use Finance::QuoteHist::Yahoo
$q = new Finance::QuoteHist::Yahoo
(
symbols => "SPY",
start_date => '01/01/2012',
end_date => 'today',
);
# Values
foreach $row ($q->quotes()) {
($symbol, $date, $open, $high, $low, $close, $volume) = @$row;
print "$symbol, $date, $open, $high, $low, $close, $volume \n";
}
SPY, 2012/09/07, 144.0100, 144.3900, 143.8800, 144.3300, 107272100
SPY, 2012/09/10, 144.1900, 144.4400, 143.4600, 143.5100, 86458500
SPY, 2012/09/11, 143.6000, 144.3700, 143.5600, 143.9100, 88760000
SPY, 2012/09/12, 144.3900, 144.5500, 143.9000, 144.3900, 87640900
SPY, 2012/09/13, 144.3700, 147.0400, 143.9900, 146.5900, 225470200
SPY, 2012/09/14, 146.8800, 148.1100, 146.7600, 147.2400, 169777000
SPY, 2012/09/17, 146.9400, 147.1900, 146.3700, 146.7400, 119427800
SPY, 2012/09/18, 146.4900, 146.8100, 146.2500, 146.6200, 98326600
SPY, 2012/09/19, 146.7900, 147.1700, 146.4100, 146.7000, 128318300
SPY, 2012/09/20, 146.0300, 146.7900, 145.6300, 146.7100, 153955400
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.