行业与产业#
行业类别#
Sector 和 Industry 模块提供对行业和产业信息的访问。
|
代表一个金融市场板块,并允许检索与该板块相关的数据,如顶级ETF、顶级共同基金和行业数据。 |
|
代表某个行业领域内的一个细分行业。 |
另请参阅
Sector.industries行业板块与细分领域分布图
示例代码#
要初始化,请使用以下相关的行业或产业键。
import yfinance as yf
tech = yf.Sector('technology')
software = yf.Industry('software-infrastructure')
# Common information
tech.key
tech.name
tech.symbol
tech.ticker
tech.overview
tech.top_companies
tech.research_reports
# Sector information
tech.top_etfs
tech.top_mutual_funds
tech.industries
# Industry information
software.sector_key
software.sector_name
software.top_performing_companies
software.top_growth_companies
模块可以像下面这样与Ticker链接起来。
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()