Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get data from a site like Yahoo Finance? [closed]

I have a project that I need help with. I want to be able to go to a website of my making, e.g. abc123.com, and have it display the Dow Jones Index. That's it. Just display one number like 12050 on my abc123.com website.

Obviously I have to get the data from somewhere like Yahoo Finance. I don't want to download any .csv files or anything like that. And it doesn't need to be real time data since I know Yahoo's data is 15 minutes delayed. Just want to be able to visit my own site and see what the Dow Jones Index is.

Before asking this question I did research some similar questions on SO, but a lot of them were unanswered or references YQL (something I'm looking into and trying to comprehend at this moment).

Any guidance on the simplest way to do this would be greatly appreciated! I am a beginning programmer in HTML and am looking for the easiest-to-understand-and-implement route.

like image 899
phan Avatar asked Dec 02 '11 19:12

phan


2 Answers

You can't. Not programmatically, but legally.

Quotes delayed, except where indicated otherwise. Delay times are 15 mins for NASDAQ, NYSE and Amex. See also delay times for other exchanges. Quotes and other information supplied by independent providers identified on the Yahoo! Finance partner page. Quotes are updated automatically, but will be turned off after 25 minutes of inactivity. Quotes are delayed at least 15 minutes. All information provided "as is" for informational purposes only, not intended for trading purposes or advice. Neither Yahoo! nor any of independent providers is liable for any informational errors, incompleteness, or delays, or for any actions taken in reliance on information contained herein. By accessing the Yahoo! site, you agree not to redistribute the information found therein.

All of the major market data providers have some sort of legal stuff like that.

But if you were going to do it anyways, I would probably download the html and parse it in order to find the quote you're looking for.

If you want to do it legally you're going to have to pay a lot of money to get the data from either the exchange itself or a third party entity that relays the information. In that case you're going to have to use whatever API they provide.

Sources: trying to do what you're thinking about doing :)

(EDIT) To those who say use YQL:

Take a look at the Terms of Use.

You can not:

Sell, lease, share, transfer, or sublicense YQL or derive income from the use of YQL in conjunction with Yahoo! APIs or other web services, whether for direct commercial or monetary gain or otherwise, without Yahoo!'s prior, express, written permission

or

Use YQL in a product or service that competes with products or services offered by Yahoo!

Any site that is sharing stock quotes is going to be competing with finance.yahoo.com and therefore disobeying the terms of use of YPL. Furthermore, you won't be able to make any money off of what you're doing with this data. Good luck getting express written consent.

Read under "The Dark Side" here on YQL too: "who owns my code? Technically, they own everything."

YQL isn't a good solution in terms of scalability, profitability, simplicity, or legality. If you don't care about any of these things and your web application isn't going to be popular or make you money, and you don't mind writing a bunch of code to play nicely with Yahoo! then YQL is the way to go.

(EDIT #2)

If you are just trying to display the information for yourself (not sharing it with others), I find it extremely easy to parse html and display it on a website with C#/Visual Basic and ASP.NET rather than php. You can create an http request in C#/VB which will (eventually) return an html file, which you can parse or search through for your Dow Jones Index quote. Do this all in C#/VB as the back end of an ASP web application. I believe you can create these with Visual Studio 2010 Express which is free.

like image 54
Andrew Rasmussen Avatar answered Nov 03 '22 00:11

Andrew Rasmussen


I am not sure whether there's a legal limit for doing this. There are lots of commercial (paid) apps that pull data from Yahoo Finance, and have been working fine for years. I'd say that the trick here is that these apps are installed into the user's device (iOS/Android/Windows devices), and therefore they pull data from Yahoo Finance for the user's own personal use.

Maybe if you pulled the data from Yahoo Finance through Javascript and didn't store it in your servers, the same case would apply to your project. As a matter of fact, I would actually think so. The only difference in this case is that your code would not need to be installed on the user's device, as it is a web page.

Have you tried to contact YQL or Yahoo Finance's support to discuss the legal limits of your projects?

like image 34
user1565668 Avatar answered Nov 03 '22 01:11

user1565668