LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do one download the csv file that Yahoo generates when looking for a company's stock historical data using LabVIEW?

I would like to use LabVIEW to download and save a CSV file that the Yahoo server generates based on my query. I can query the Yahoo server to provide me with a page by simply using the address link that follows;

http://finance.yahoo.com/q/hp?s=GE&a=00&b=1&c=1900&d=02&e=31&f=2005&g=d

The problem is that now, I would like to use this page to generate the CSV file and have LabVIEW take care of it.

Has anybody done this or know how to do it?

Thanks ahead.
0 Kudos
Message 1 of 17
(5,627 Views)
I have!

I use the datasocket functions to read the page and have found that appending the string [text] at the end of the url is required. Here is the url I use (notice the ticker, for a highly regarded company, is used twice):

http://chart.yahoo.com/table.csv?s=NATI&a=10&b=03&c=2003&d=12&e=31&f=2004&g=d&q=q&y=0&z=NATI&x=.csv[text]

If you need more help I can post some example VI's.
Message 2 of 17
(5,619 Views)
Thanks a bunch RLD,

You just saved me a bunch of time. Let me know if I can help you on anything. Just Awesome I tell you. Something as simple as appending "[text]" at the end of the URL. Who would've thought. I love datasockets, aren't they just amazing. They are so handy.
I take it you've attempted to scan the market before. I am planing to load this to a database and search out patterns. Possibly then publish results in a website for others to take advantage of. By the way, do you know of a vi that charts candlesticks? I've started one but if there is one already available, why waste time.
Just one more question. Where in the world were you able to find out about having to append "[text]" at the end. Is this a Yahoo webserver command, is it a datasocket thing, or is it a typical HTTP protocol attribute?

Thanks again RLD,

Wil
0 Kudos
Message 3 of 17
(5,604 Views)
Glad to be of help.

I think the "[text]" is a HTTP thing, but I developed the original code back in the LV5.1 days and no longer remember how I figured it out. I may have found it on the NI web site, or in the LabVIEW Internet Toolkit docs.

As to candlesticks, you can refer to the SPC Tool kit to see how they create charts with similar displays. I have not seen any LabVIEW VI's for candlesticks.

BTW be aware Yahoo historical data has a "quirky" way of handling stock splits and dividend distributions.
0 Kudos
Message 4 of 17
(5,602 Views)
Yes, I noticed quirk with the way Yahoo handles the splits, etc... Im not sure I understand it right now but I guess that's another hurdle I will have to overcome.

BTW, I hope you didn't have Stock in NATI, take a look at it today. It's time to wait and be patient.

Wil
0 Kudos
Message 5 of 17
(5,596 Views)
Hello RLD,

Could you (or someone who knows how) post some example vi to download data from yahoo? I tried using data socket read as suggested in your message, but cant get it work. Never used it before, would appreciate your advise with some basics. Also how do you handle multiple symbols?

Many thanks,
Bryan
0 Kudos
Message 6 of 17
(5,562 Views)
I'm attaching a zip file with two html printouts of a top level VI and a subVI. The subVI constructs the date range string for historical period of interest. This is example was created in LV7.1, but I've used the same basic structure in LV5 and LV6.
0 Kudos
Message 7 of 17
(5,547 Views)
Hi RLD, thanks for replying but you may have forgot to attach the files. By using an example vi I got from NI I was able to down load the csv file of the daily data. Now the challenging part is to down load the hourly and weekly data. Do you know the corresonding URLs for those? Also I wonder if anyone be able to down load the earnings calenda into a csv file?

Bryan.
0 Kudos
Message 8 of 17
(5,535 Views)
No you can not download the Yahoo earnings calendar into a CSV file. You can read simple html pages with DataSocket reader. Of course you get html strings which must be "unassembled" to get the data you are interested in. However, if the page contains a lot of scripts the resulting html string will not have the data you wanted. I've had better luck using a LabVIEW Active-X container with the Web Browser. There's an example "GetHTMLSourceString.vi" on the NI site showing how to pull off html from a web page.

Sorry about the attachment that didn't make it. I should've put printed it to a pdf.
Message 9 of 17
(5,534 Views)
Great suggestions! I got the html source string easily with the posted vi...but to parse the string into a calendar table looks prety hard. All i need are the symbols and date/time info. Wonder if there is an easy way?
0 Kudos
Message 10 of 17
(5,526 Views)