Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Welcome to the Monastery
 
PerlMonks  

Get US stock tables from WSJ

by Scott7477 (Chaplain)
on Sep 19, 2006 at 03:31 UTC ( #573628=snippet: print w/ replies, xml ) Need Help??

Description: After years of posting daily stock prices on its website in practically useless pdf files; the Wall Street Journal has set up a page where one can download daily stock price data as CSV files. This script simply goes to the relevant page at WSJ.com, downloads the files, and names each file with the market acronym and the day's date concatenated. Updated: to reflect change in WSJ site.
use strict;
use LWP::Simple;
while (my $downloadurl = <DATA>){
    my $x="http://online.wsj.com/public/resources/documents/";
    my $finurl=$x.$downloadurl;
    my @urlsplit=split /\./, $downloadurl;
     my $now_string = substr(localtime,0,11);
    my $savefilename = $urlsplit[0].$now_string;
    print $savefilename;
    print "\n";
    my $status = getstore($finurl,$savefilename);
    print $status."\n" if is_success($status);            }
    

__END__;
NYSE.csv
Nasdaq.csv
SCAP.csv
AMEX.csv
Comment on Get US stock tables from WSJ
Download Code

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://573628]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-04-17 09:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (443 votes), past polls