Using Python for Financial Data/Analyses

Ongoing Notes

Yahoo Finance one maintained an API.
However, this one is where it is at:
https://github.com/ranaroussi/yfinance

Basic use of yfinance:

from pandas_datareader import data as pdr
import yfinance as yf

The library is pretty deep. However, for most things, IMO, the “ticker” class is probably all you need.

aaplObj = yf.Ticker(“AAPL”)
aaplObj.dividends
# get dividends for 2018
aapl2018Dividend=sum(aaplObj.dividends.values[curTick.dividends.index.year==2018])

etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s