Google Finance - Realtime data ??


Well-Known Member
Can anyone debug this code and provide us the working code to be used with Python 3.2.1 for Windows.

import urllib2
import json
import time

class GoogleFinanceAPI:
def __init__(self):
self.prefix = ""

def get(self,symbol,exchange):
url = self.prefix+"%s:%s"%(exchange,symbol)
u = urllib2.urlopen(url)
content =

obj = json.loads(content[3:])
return obj[0]

if __name__ == "__main__":
c = GoogleFinanceAPI()

while 1:
quote = c.get("MSFT","NASDAQ")
print quote

The above code prints the Quote for Microsoft stock on NASDAQ every 30 seconds.

This is a code found on Net - It is not at all mine.
For more details -


Well-Known Member
I don't know If I am reinventing the wheel.But would surely like to continue searching for tool/utility/script to fetch realtime quotes from Google finance with less 1 min delay.

The above python script gave me following output after pointing to NSE.Now searching for parsing.

{u'c': u'+1.55', u'ccol': u'chg', u'e': u'NSE', u'ltt': u'3:58PM IST', u'l': u'8
01.55', u's': u'0', u'lt': u'Aug 16, 3:58PM IST', u't': u'TATAMOTORS', u'cp': u'
0.19', u'id': u'9708440', u'l_cur': u'Rs.801.55'}


Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Are you a day trader?