@@ -0,0 +1,2133 @@
+# -- ------------------------------------------------------------------------------ -- #%0A# -- Funciones de Google Finance API ---------------------------------------------- -- #%0A# -- Desarrollador Inicial: IF Francisco ME --------------------------------------- -- #%0A# -- Licencia: MIT ---------------------------------------------------------------- -- #%0A# -- ------------------------------------------------------------------------------ -- #%0A%0Aimport json%0Afrom urllib2 import Request, urlopen%0A%0AgoogleFinanceKeyToFullName = %7B%0A    u'id': u'ID',%0A    u't': u'StockSymbol',%0A    u'e': u'Index',%0A    u'l': u'LastTradePrice',%0A    u'l_cur': u'LastTradeWithCurrency',%0A    u'ltt': u'LastTradeTime',%0A    u'lt_dts': u'LastTradeDateTime',%0A    u'lt': u'LastTradeDateTimeLong',%0A    u'div': u'Dividend',%0A    u'yld': u'Yield',%0A    u's': u'LastTradeSize',%0A    u'c': u'Change',%0A    u'el': u'ExtHrsLastTradePrice',%0A    u'el_cur': u'ExtHrsLastTradeWithCurrency',%0A    u'elt': u'ExtHrsLastTradeDateTimeLong',%0A    u'ec': u'ExtHrsChange',%0A    u'ecp': u'ExtHrsChangePercent',%0A    u'pcls_fix': u'PreviousClosePrice'%0A%7D%0A%0A%0Adef buildUrl(symbols):%0A    symbol_list = ','.join(%5Bsymbol for symbol in symbols%5D)%0A    # a deprecated but still active & correct api%0A    return 'http://finance.google.com/finance/info?client=ig&q=' %5C%0A           + symbol_list%0A%0A%0Adef request(symbols):%0A    url = buildUrl(symbols)%0A    req = Request(url)%0A    resp = urlopen(req)%0A    # remove special symbols such as the pound symbol%0A    content = resp.read().decode('ascii', 'ignore').strip()%0A    content = content%5B3:%5D%0A    return content%0A%0A%0Adef replaceKeys(quotes):%0A    global googleFinanceKeyToFullName%0A    quotesWithReadableKey = %5B%5D%0A    for q in quotes:%0A        qReadableKey = %7B%7D%0A        for k in googleFinanceKeyToFullName:%0A            if k in q:%0A                qReadableKey%5BgoogleFinanceKeyToFullName%5Bk%5D%5D = q%5Bk%5D%0A        quotesWithReadableKey.append(qReadableKey)%0A    return quotesWithReadableKey%0A%0A%0Adef getQuotes(symbols):%0A    if type(symbols) == type('str')%0A        symbols = %5Bsymbols%5D%0A    content = json.loads(request(symbols))%0A    return replaceKeys(content)%0A%0A%0AgetQuotes(%5B'AAPL', 'GOOG'%5D)%0A

Add Real Time Quotes