Skip to content

Instantly share code, notes, and snippets.

@andyfinity
Created July 18, 2020 04:56
Show Gist options
  • Save andyfinity/9d0dbbafb520363c48b4dd3e7120d515 to your computer and use it in GitHub Desktop.
Save andyfinity/9d0dbbafb520363c48b4dd3e7120d515 to your computer and use it in GitHub Desktop.
Example of how to use the yfinance library to fetch mutual fund pricing information.
import yfinance as yf
# Tickers to watch
l = ['BIOPX', 'FBSOX', 'FSCSX']
# Method 1 (includes lots of info that isn't shown)
for symbol in l:
tckr = yf.Ticker(symbol)
print(symbol, tckr.info['previousClose'])
# Method 2 (includes historical data)
data = yf.download(' '.join(l), start='2020-07-01', end='2020-07-16')
print(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment