Coder Social home page Coder Social logo

googlefinance's Introduction

googlefinance

Python module to get stock data from Google Finance API

This module provides no delay, real time stock data in NYSE & NASDAQ.

Another awesome module, yahoo-finance's data is delayed by 15 min, but it provides convenient apis to fetch historical day-by-day stock data.

##Install From PyPI with pip:

$pip install googlefinance

From development repo (requires git)

$git clone https://github.com/hongtaocai/googlefinance.git
$cd googlefinance
$python setup.py install

##Usage example

>>> from googlefinance import getQuotes
>>> import json
>>> print json.dumps(getQuotes('AAPL'), indent=2)
[
  {
	"Index": "NASDAQ", 
    "LastTradeWithCurrency": "129.09", 
    "LastTradeDateTime": "2015-03-02T16:04:29Z", 
    "LastTradePrice": "129.09", 
    "Yield": "1.46", 
    "LastTradeTime": "4:04PM EST", 
    "LastTradeDateTimeLong": "Mar 2, 4:04PM EST", 
    "Dividend": "0.47", 
    "StockSymbol": "AAPL", 
    "ID": "22144"
  }
]
>>> print json.dumps(getQuotes(['AAPL', 'VIE:BKS']), indent=2)
[
  {
    "Index": "NASDAQ", 
    "LastTradeWithCurrency": "129.36", 
    "LastTradeDateTime": "2015-03-03T16:02:36Z", 
    "LastTradePrice": "129.36", 
    "LastTradeTime": "4:02PM EST", 
    "LastTradeDateTimeLong": "Mar 3, 4:02PM EST", 
    "StockSymbol": "AAPL", 
    "ID": "22144"
  }, 
  {
    "Index": "VIE", 
    "LastTradeWithCurrency": "17.10", 
    "LastTradeDateTime": "2015-03-03T13:30:30Z", 
    "LastTradePrice": "17.10", 
    "LastTradeTime": "1:30PM GMT+1", 
    "LastTradeDateTimeLong": "Mar 3, 1:30PM GMT+1", 
    "StockSymbol": "BKS", 
    "ID": "978541942832888"
  }
]

>>> from googlefinance import getNews
>>> import json
>>> print json.dumps(getNews("GOOG"), indent=2)
[
  {
    "usg": "AFQjCNEndnF6ktTO4yZ7DO6VWNNKuNLRqA",
    "d": "Feb 26, 2016",
    "tt": "1456499673",
    "sp": "Alphabet logo Alphabet Inc (NASDAQ:GOOG) CEO Lawrence Page sold 33,332 shares of the firm's stock in a transaction dated Tuesday, March 22nd.",
    "s": "Financial Market News",
    "u": "http://www.financial-market-news.com/alphabet-inc-goog-ceo-lawrence-page-sells-33332-shares/996645/",
    "t": "Alphabet Inc (GOOG) CEO Lawrence Page Sells 33332 Shares",
    "sru": "http://news.google.com/news/url?sa=T&ct2=us&fd=S&url=http://www.financial-market-news.com/alphabet-inc-goog-ceo-lawrence-page-sells-33332-shares/996645/&cid=52779068349451&ei=jVn_VsrfApXcuATP4JvQBw&usg=AFQjCNHkHXAJIZRMHo9ciTAb7OWzj9pKvA"
  },
  {
    "usg": "AFQjCNHfaafHtJPn5GWu-6RiVG_J_1TYUw",
    "d": "Mar 26, 2016",
    "tt": "1458951075",
    "sp": "You don't get to $300 billion without overcoming your fair share of problems. This truism certainly applies individually to tech titans Alphabet (NASDAQ:GOOG) (NASDAQ:GOOGL) and Apple (NASDAQ:AAPL) at different points in their respective corporate ...",
    "s": "Motley Fool",
    "u": "http://www.fool.com/investing/general/2016/03/25/alphabet-inc-eyes-a-new-road-to-mobile-success-in.aspx",
    "t": "Alphabet Inc Eyes a New Road to Mobile Success in the Most Unlikely Places",
    "sru": "http://news.google.com/news/url?sa=T&ct2=us&fd=S&url=http://www.fool.com/investing/general/2016/03/25/alphabet-inc-eyes-a-new-road-to-mobile-success-in.aspx&cid=52779068349451&ei=jVn_VsrfApXcuATP4JvQBw&usg=AFQjCNEFa7EPWB-kyl2C23OTRHOWRJN52w"
  }
]

googlefinance's People

Contributors

hayd avatar hongtaocai avatar madeenamadou avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.