开发者

How do I get and compare stock quotes from Yahoo! and Google?

How to get a history quote from Yahoo and Google Finance with Perl and save in DB to compare and validat开发者_如何学运维e. What´s the best/simple Perl/Windows DB to make this and the Perl/Algoritmo to compare this data?


  • To get historical quotes (as opposed to current), you can either use existing CPAN modules (e.g. Finance::QuoteHist::Yahoo / Finance::QuoteHist::Google - which are top links if you bother Googling "cpan historical yahoo quotes" ) or roll your own as follows:

    • use LWP::Mechanize to retrieve Y! and G! historical data from relevant URLs as HTML (to the best of my knowledge, the official Yahoo CSV quote API doesn't do historical though I could be wrong).

    • use an HTML parser like HTML::TreeBuilder to parse that HTML and extract quote data.

  • To store the data, use pretty much any database - from a simple CSV file to SQLite database (or DBM file, or MySQL, but I'm not sure the last 2 work on Windows). Which one to pick depends on how much data you want to store and what you want to do with it.

  • To compare, you can either run a database query/report, depending on what your comparison needs to compute; or retrieve data (in bulk or in a per-security loop) into your program and compare in Perl code. Can't provide any more specifics without a lot clearer explanation of WHAT you want to compare and how.

If you have more specific questions about each of these steps, please feel free to post what you've done, what the problems are which arose and SO will be glad to help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜