views:

5545

answers:

7

Does anyone know of a way to obtain free real-time stock data or near real-time stock data? I'd like to do this since I'm interested in the financial market, not for use in investment applications which is why I'm looking for something free.

I've tried the Perl module Finance::YahooQuote but some of the fields such as last trade time appear to be broken. I've looked at the historical data but it doesn't fit my needs since I'd like to monitor the movements of the markets and stocks during the trading day not just open and close. I've also looked at http://www.opentick.com but they aren’t accepting new accounts and I can't find a timeline for when their network upgrade will be complete.

+11  A: 

You can get real-time stock quotes from Google Finance. You can use the API if you want to write your own scripts.

Bill the Lizard
I looked at the google API but my understanding is it only allows you to manage portfolios and get information on transactions that take place in them not get data on individual stocks outside the portfolio. If this is incorrect I'd appreciate pointers on how to get individual stock data.
Jared
It's a little bit of a pain, but you can have multiple portfolios, so you can just create a portfolio with the single stock you're interested in.
Bill the Lizard
I explored a bit Google Finance. They also have plenty of historical data and you can export it. Really nice!
Joe Pineda
Google Finance is real time for NYSE, NASDAQ I think, but is it real time for all other stock exchange?
Daok
@Doak can't speak for the Non-US, Non-EuroNext markets, but you are not going to find any real-time US market data for free. Real time quote subscription fees bring in a lot of money to the exchanges. They wouldn't let them be available to anyone for free.
sal
Could you theoretically create a Google "portfolio" with EVERY stock in it in order to achieve what you want? =)
cakeforcerberus
@semirhage: Unfortunately, no. According to the Google Power Tools Bible, the number of stocks you can track is limited at 200. Unrelated question for you: Did you kill Asmodean?
Bill the Lizard
@Bill the Lizard: It was Mesaana, I swear! :)
cakeforcerberus
@semirhage: Thanks. Of course, I cannot trust you. I just *know* it was one of you, though! :)
Bill the Lizard
@Bill the Lizard: The truth shall be revealed in Book 6 of "A Memory of Light", due out sometime in Q4 3010. :*(
cakeforcerberus
+10  A: 

Yahoo offers delayed-by-15 stock updates. They have a CSV you can download and parse quite easily. Different datapoints are available depending on what options you pass into the GET portion of the URL.

I use that facility myself.

Yahoo's page

Another page about it

Paul Nathan
+8  A: 

I've written a short python program pasted below that uses Yahoo's stock data to get the data on the Dow Jones average, Ford, and Microsoft, then enters that data into a CSV file. The Dow data appears to updated in real-time or with a one minute delay while other stocks are delayed by 15 minutes. This program is a simple console program that checks the given stock prices every 2 minutes. Note about constructing URL's the symbol for Dow is ^DJI but yahoo replaces the ^ with %5E For information on the yahoo API see this site. http://computerprogramming.suite101.com/article.cfm/using_yahoo_financial

Here is the code.

import urllib
import os
import time

# loop that checks stock prices every 20 seconds and adds them to the file
while 1:
    # sometimes this program gives me socket errors so if it does skip this itteration of the loop
    try:
        stocks = urllib.urlopen('http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI+MSFT+F&f=sd1t1l1va2abc1ghk3ops7&e=.csv').read()
    except IOError:
        print ("error reading the socket\n")
        time.sleep(120) #if we don't sleep here loop constently retrys with no delay
        continue

    # if csv doesn't exist create it and write header information
    if os.path.exists('stocks.csv')==0:
        stocksFile = open ( 'stocks.csv', 'a' )
        stocksFile.write("symbol,last trade date,last trade time,last trade price,volume,average daily volume,ask,bid,change,days low,days high,last trade size,open,previous close,short ratio\n")
    stocksFile = open ( 'stocks.csv', 'a' )
    stocksFile.write(stocks)
    stocksFile.close()
    time.sleep(120)
Jared
+1  A: 

As indicated in the comments there are no sources of tree tick data which if you are looking for realtime I assume you want. Also you need to think about the depth of data that you want. Last trade, Top of Book Quotes, Full Book, etc..

For getting started I have used IQFeed. The work reasonably well and offer 30 days of full tick data and I believe one year of 1 minute bars. I have not used the streaming code for watching the tick stream yet but I have heard it is good.

OpenTick I heard was not going to reopen.

Steve
Is IQFeed available for non-Windows platforms (ie. Mac)?
nall
No. I do not believe so. If you are looking for more cross platform enabled solutions you will probably need a professional ticker plant. You could also use CQG but they are significantly more expensive. Your best bet is probably to use a windows box to download the data and then use it from your mac.
Steve
+2  A: 

Use NinjaTrader with whatever demo broker you want. It has even Level II data. Then you can code in C# whatever you want to get the data out of the platform (eg. MemoryMappedFiles, TCP Sockets ...)

csebastian
+1  A: 

In addition to the Yahoo and Google API's take a look at the Interactive Brokers API. This has access to both delayed and real time data via their API.

http://www.interactivebrokers.com/en/p.php?f=programInterface

Brian
A: 

Thanks for the great info

this should be a comment, not an answer
warren