27

I would like to make an program that acts like a big filter for stocks. To do so, I need to have real-time (or delayed) quotes from the market. I started getting stock quotes by requesting pages from yahoo, accordingand parsing the html to the ticker, and parsing the html. I was wondering how to do this requesting and parsing html. Is there some way I can request only the stock quotes and its info? I know some applications do this, and I am very curious how they do it, because requesting web pages and parsing them is very time-consuming.

Thanks, Dave

David Menard
  • 2,261
  • 3
  • 43
  • 67
  • I am doing something similar including option prices. I know you can get pay access, but a web service with pricing would be priceless if free. :) – kenny Dec 29 '09 at 15:06
  • 1
    I know this doesn't answer your question, but this may help you anyway: Since you're building a "filter" for stocks, you may need company fundamental information (revenue, profit, number of employees, industry codes, etc) - a great place to get all of that is the Mergent Fundamentals API - http://www.mergent.com/servius/ – Eugene Osovetsky Aug 20 '10 at 04:15
  • For a ready made solution check the following link codecanyon.net/item/livecurrent-stock-price-/17489243 . DLL and sample code file provided,very easy to integrate in web as well as desktop applications. – sambit.albus Aug 23 '16 at 16:27

11 Answers11

29

Parsing the output of the webpage is a chump's game. It is always changing and unless you're willing to heavily invest in some sort of very resilient parser you're going to spend your life twiddling with it. Use a web service, google offers one http://googleblog.blogspot.com/2007/01/real-time-quotes-for-free.html

stimms
  • 42,945
  • 30
  • 96
  • 149
  • 5
    Yahoo offers there data for free check out http://jarloo.com/tutorials/get-yahoo-finance-api-data-via-yql/ to learn YQL and how to download Yahoo Finance data. – Kelly Nov 29 '10 at 04:07
  • 1
    what you say is true, I just wanted to add that if you are forced to do html parsing, using jsoup and xpath will make that task a lot easier. Sometimes the data you need just isn't available any other way. – msknapp Feb 16 '14 at 21:21
  • 7
    This Google page seems to have nothing but an empty promise. Where is the Web service? – Jonathan Wood Mar 09 '16 at 20:05
  • For a ready made solution check the following link http://codecanyon.net/item/livecurrent-stock-price-/17489243 . DLL and sample code file provided,very easy to integrate in web as well as desktop applications. – sambit.albus Aug 23 '16 at 16:26
  • @Kelly Yahoo has just discontinued the service. – Dave Friedel Nov 13 '17 at 14:47
10

You can get csv data from yahoo.

This page has more information.

Mongus Pong
  • 11,337
  • 9
  • 44
  • 72
4

The Google and Yahoo API's have both gone away. However, Investor's Exchange offers an API that's very easy to use for quote data.

J. Peterson
  • 1,996
  • 1
  • 24
  • 21
3

Afaik, this kind of data is available via subscription based models, Xignite is one that comes to mind. To my knowledge, NASDAQ and the NYSE do not provide any freely usable API's.

mpurkeypile
  • 148
  • 5
Ta01
  • 31,040
  • 13
  • 70
  • 99
1

this internally uses yahoo stock api. i hope this one helps you out.

https://github.com/bhattumang7/gold-silver-share-price-api-india

1

There is actually a yahoo web service that will return CSV file of stock quotes. So no HTML parsing needed

Aye
  • 393
  • 2
  • 13
1

In the financial services industry, most banks will have a real time feed provided by Reuters or Bloomberg, but this, obviously, will cost a lot of money. If you Google for "stock price feed" or "market data feed" you will get some options, some free, some paid for.

I would also recommend using a Complex Event Processing engine such as Esper for doing this sort of real time processing, it will be substantially easier than writing the whole application stack from scratch.

John Channing
  • 6,501
  • 7
  • 45
  • 56
1

For downloading yahoo finance stock quotes in C# or VB.NET you can use the "Yahoo! Finance Managed" library.

Click here

Maas
  • 11
  • 1
0

Here is a list of websites that provide free intraday data.

You can export the data and use it in your software

kleopatra
  • 51,061
  • 28
  • 99
  • 211
Atom
  • 1
  • 1
0

Try to look at this channel9 presentation. It is a F# introduction but from 27:00 the presenter, Luca Bolognesi, creates an application that does some of the work you are asking for (in F# but very inspirational - to me at least).

Moberg
  • 783
  • 1
  • 8
  • 17
0

Using Fidelity.com & inspecting the element for the selling price you can manipulate the URL to search any stock from inside your program.

Using Visual Studio Community 2013 C#