= yfinance = * https://pypi.org/project/yfinance/ yfinance aimes to solve this problem by offering a reliable, threaded, and Pythonic way to download historical market data from Yahoo! finance. * pip install yfinance --user {{{#!highlight python import yfinance from pandas._libs.tslibs.timestamps import Timestamp data = yfinance.download("AMZN",start="2019-01-01",end="2020-02-12") d = data.to_dict() d['Close'].key # for k in d['Close'].iterkeys(): print (k) d['Close'][Timestamp('2019-11-22 00:00:00')] d['Close'][Timestamp('2020-02-10 00:00:00')] }}} == MSFT example == {{{#!highlight sh cd ~/Documents/ mkdir yfinance-test cd yfinance-test/ sudo apt install python3-venv python3 -m venv testVenv source testVenv/bin/activate pip install yfinance python3 test-msft.py }}} === test-msft.py === {{{#!highlight python import yfinance as yf msft = yf.Ticker("MSFT") historyDataFrame = msft.history(period="5d") print("Available columns") for colname in historyDataFrame: print(" "+colname) print("Available indexes") for row in historyDataFrame.index: print(" "+str(row)) columnClose = historyDataFrame['Close'] rowidx = 0 print("Symbol:"+msft.info['symbol']) for closeValue in columnClose.values: print(historyDataFrame.index[rowidx], closeValue) rowidx += 1 }}}