yfinance-9.py
· 313 B · Python
Sin formato
import yfinance as yf
# Ticker to Sector and Industry
msft = yf.Ticker('MSFT')
tech = yf.Sector(msft.info.get('sectorKey'))
software = yf.Industry(msft.info.get('industryKey'))
# Sector and Industry to Ticker
tech_ticker = tech.ticker
tech_ticker.info
software_ticker = software.ticker
software_ticker.history()
1 | import yfinance as yf |
2 | |
3 | # Ticker to Sector and Industry |
4 | msft = yf.Ticker('MSFT') |
5 | tech = yf.Sector(msft.info.get('sectorKey')) |
6 | software = yf.Industry(msft.info.get('industryKey')) |
7 | |
8 | # Sector and Industry to Ticker |
9 | tech_ticker = tech.ticker |
10 | tech_ticker.info |
11 | software_ticker = software.ticker |
12 | software_ticker.history() |