How to create a stock quote fetching app in python

后端 未结 8 843
闹比i
闹比i 2020-12-07 22:05

I\'m quite new to programming in Python.

I want to make an application which will fetch stock prices from google finance. One exam

8条回答
  •  無奈伤痛
    2020-12-07 22:37

    As for now (2015), the google finance api is deprecated. But you may use the pypi module googlefinance.

    Install googlefinance

    $pip install googlefinance
    

    It is easy to get current stock price:

    >>> 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"
      }
    ]
    

    Google finance is a source that provides real-time stock data. There are also other APIs from yahoo, such as yahoo-finance, but they are delayed by 15min for NYSE and NASDAQ stocks.

提交回复
热议问题