nasdaq.com web data scrapping

Closed - This job posting has been filled.

Job Description

Hi,

I would like to get the data from here:
http://www.nasdaq.com/symbol/spy/premarket#.UR48DaWgIkM
and here:
http://www.nasdaq.com/symbol/spy/after-hours#.UR48KaWgIkM
For any arbritrary symbol (in the link above, the symbol is spy).

I would like the data printed out in a csv file with rows like this:
20130115,729,146.35,146.35,146.35,146.35,1900,1,0,0,0
The last four columns is always 1,0,0,0
The first column is the date, this can be passed in as a command line argument and doesn't need to be extracted from the page.
The second column is the time. Time should be something like 729 for 729AM EST, and 1630 for 4:30PM EST.
The next 5 columns are open, high, low, close, volume. For 729 for example, they would be derived by taking all of the trades listed for 729AM and extracting the open (first trade in 729), close (last trade in 729), and high/low which is the highest and lowest priced trade in that minute. Finally, volume should be the sum of the volume of all trades in that minute.

Lastly, I would like data for the entire premarket session (4AM to 9:30AM) and the entire aftermarket session (4PM to 8PM). This means in the part of the page where it says: "In the drop-down select the time range to see more trades:", you will need to query the different time intervals they have listed there, and then grab data for every trade in that interval by going through the pages for each time interval.

Please sleep for 100ms between requests so we don't DDOS the nasdaq servers on accident (but make this a changeable parameter in the code).

The output filename should be table_spy.csv in this case. The output directory should be given to the code as an input, along with the path to a text file containing symbols. The text file would look something like this:
spy
msft
aapl

where there is one symbol per row.

I would like a separate code for both premarket and aftermarket (they should both be extremely similar). Both codes should be able to run from the Linux command line. The language used does not matter but please specify when responding what language you will use.

Budget for this job is $100 and seeking to have this done in the next 48 hours.

---
Skills: linux