PYTHON笔记十一:使用yfinance查看股票信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import yfinance as yf

aapl= yf.Ticker("aapl")
aapl
print(aapl.info['symbol']) #股票代码
#AAPL
print(aapl.info['trailingPE']) #历史市盈率(P/E)=每股价格/每股收益(同行业内越低越好,每股收益可能为负,而且容易被操纵)
#26.029095
print(aapl.info['forwardPE']) #远期市盈率
#23.818598
print(aapl.info['priceToBook']) #市净率(P/B)=每股价格/每股净资产(同行业内越低越好,P/E为负时作重要参考,但要考虑杠杆)
#35.330532
print(aapl.info['currentPrice']/aapl.info['totalCashPerShare']) #市现率=每股价格/每股现金流(同行业内越低越好,很难操纵)
#39.51225740551583
print(aapl.info['priceToSalesTrailing12Months']) #市销率(P/S)=每股价格/每股销售额(同行业内越低越好,很难操纵)
#6.674457
print(aapl.info['dividendRate']) #股息率=每年总派息额/每年市价
#0.88
print(aapl.info['dividendYield']) #现金殖利率=每股股息/每股股价
#0.0055
print(aapl.info['currentPrice']) #当前股价
#156.545
print(aapl.info['targetMedianPrice']) #预期中位股价
#199.5
print(aapl.info['targetMeanPrice']) #预期平均股价
#193.53
print(aapl.info['targetHighPrice']) #预期最高股价
#215
print(aapl.info['recommendationKey']) #推荐购买
#buy
print(aapl.info['totalCashPerShare']) #每股现金流
#3.916
print(aapl.info['revenuePerShare']) #每股收入
#22.838
print(aapl.info['bookValue']) #每股净资产
#4.402

如下四个指标反映企业的盈利能力,企业与企业比较,或企业与行业平均比较,或企业与历史同期比较

1
2
3
4
5
6
7
8
print(aapl.info['grossMargins']) #毛利率
#0.43019
print(aapl.info['profitMargins']) #净利率
#0.26579002
print(aapl.info['returnOnAssets']) #总资产收益率(ROA)
#0.19875
print(aapl.info['returnOnEquity']) #净资产收益率(ROE)
#1.45567

其他信息可通过info查看,以APPL为例,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
print(aapl.info)
{'zip': '95014',
'sector': 'Technology',
'fullTimeEmployees': 100000,
'longBusinessSummary': 'Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. It also sells various related services. In addition, the company offers iPhone, a line of smartphones; Mac, a line of personal computers; iPad, a line of multi-purpose tablets; AirPods Max, an over-ear wireless headphone; and wearables, home, and accessories comprising AirPods, Apple TV, Apple Watch, Beats products, HomePod, and iPod touch. Further, it provides AppleCare support services; cloud services store services; and operates various platforms, including the App Store that allow customers to discover and download applications and digital content, such as books, music, video, games, and podcasts. Additionally, the company offers various services, such as Apple Arcade, a game subscription service; Apple Music, which offers users a curated listening experience with on-demand radio stations; Apple News+, a subscription news and magazine service; Apple TV+, which offers exclusive original content; Apple Card, a co-branded credit card; and Apple Pay, a cashless payment service, as well as licenses its intellectual property. The company serves consumers, and small and mid-sized businesses; and the education, enterprise, and government markets. It distributes third-party applications for its products through the App Store. The company also sells its products through its retail and online stores, and direct sales force; and third-party cellular network carriers, wholesalers, retailers, and resellers. Apple Inc. was incorporated in 1977 and is headquartered in Cupertino, California.',
'city': 'Cupertino',
'phone': '408 996 1010',
'state': 'CA',
'country': 'United States',
'companyOfficers': [],
'website': 'https://www.apple.com',
'maxAge': 1,
'address1': 'One Apple Park Way',
'industry': 'Consumer Electronics',
'ebitdaMargins': 0.33890998,
'profitMargins': 0.26579002,
'grossMargins': 0.43019,
'operatingCashflow': 112241000448,
'revenueGrowth': 0.112,
'operatingMargins': 0.309,
'ebitda': 128217997312,
'targetLowPrice': 160,
'recommendationKey': 'buy',
'grossProfits': 152836000000,
'freeCashflow': 80153247744,
'targetMedianPrice': 199.5,
'currentPrice': 155.525,
'earningsGrowth': 0.25,
'currentRatio': 1.038,
'returnOnAssets': 0.19875,
'numberOfAnalystOpinions': 44,
'targetMeanPrice': 193.53,
'debtToEquity': 170.714,
'returnOnEquity': 1.45567,
'targetHighPrice': 215,
'totalCash': 63913000960,
'totalDebt': 122797998080,
'totalRevenue': 378323009536,
'totalCashPerShare': 3.916,
'financialCurrency': 'USD',
'revenuePerShare': 22.838,
'quickRatio': 0.875,
'recommendationMean': 1.8,
'exchange': 'NMS',
'shortName': 'Apple Inc.',
'longName': 'Apple Inc.',
'exchangeTimezoneName': 'America/New_York',
'exchangeTimezoneShortName': 'EST',
'isEsgPopulated': False,
'gmtOffSetMilliseconds': '-18000000',
'quoteType': 'EQUITY',
'symbol': 'AAPL',
'messageBoardId': 'finmb_24937',
'market': 'us_market',
'annualHoldingsTurnover': None,
'enterpriseToRevenue': 7.027,
'beta3Year': None,
'enterpriseToEbitda': 20.735,
'52WeekChange': 0.30975795,
'morningStarRiskRating': None,
'forwardEps': 6.56,
'revenueQuarterlyGrowth': None,
'sharesOutstanding': 16319399936,
'fundInceptionDate': None,
'annualReportExpenseRatio': None,
'totalAssets': None,
'bookValue': 4.402,
'sharesShort': 108944701,
'sharesPercentSharesOut': 0.0067000003,
'fundFamily': None,
'lastFiscalYearEnd': 1632528000,
'heldPercentInstitutions': 0.59576,
'netIncomeToCommon': 100554997760,
'trailingEps': 6.015,
'lastDividendValue': 0.22,
'SandP52WeekChange': 0.080180764,
'priceToBook': 35.330532,
'heldPercentInsiders': 0.0007,
'nextFiscalYearEnd': 1695600000,
'yield': None,
'mostRecentQuarter': 1640390400,
'shortRatio': 1.08,
'sharesShortPreviousMonthDate': 1642118400,
'floatShares': 16302795170,
'beta': 1.185531,
'enterpriseValue': 2658571911168,
'priceHint': 2,
'threeYearAverageReturn': None,
'lastSplitDate': 1598832000,
'lastSplitFactor': '4:1',
'legalType': None,
'lastDividendDate': 1643932800,
'morningStarOverallRating': None,
'earningsQuarterlyGrowth': 0.204,
'priceToSalesTrailing12Months': 6.708319,
'dateShortInterest': 1644883200,
'pegRatio': 1.73,
'ytdReturn': None,
'forwardPE': 23.706554,
'lastCapGain': None,
'shortPercentOfFloat': 0.0067000003,
'sharesShortPriorMonth': 90492581,
'impliedSharesOutstanding': 0,
'category': None,
'fiveYearAverageReturn': None,
'previousClose': 158.52,
'regularMarketOpen': 158.93,
'twoHundredDayAverage': 153.4692,
'trailingAnnualDividendYield': 0.0054567247,
'payoutRatio': 0.1434,
'volume24Hr': None,
'regularMarketDayHigh': 159.2799,
'navPrice': None,
'averageDailyVolume10Day': 93466040,
'regularMarketPreviousClose': 158.52,
'fiftyDayAverage': 169.1304,
'trailingAnnualDividendRate': 0.865,
'open': 158.93,
'toCurrency': None,
'averageVolume10days': 93466040,
'expireDate': None,
'algorithm': None,
'dividendRate': 0.88,
'exDividendDate': 1643932800,
'circulatingSupply': None,
'startDate': None,
'regularMarketDayLow': 154.7475,
'currency': 'USD',
'trailingPE': 25.85453,
'regularMarketVolume': 51458660,
'lastMarket': None,
'maxSupply': None,
'openInterest': None,
'marketCap': 2537911484416,
'volumeAllCurrencies': None,
'strikePrice': None,
'averageVolume': 97572501,
'dayLow': 154.7475,
'ask': 154.86,
'askSize': 3000,
'volume': 51458660,
'fiftyTwoWeekHigh': 182.94,
'fromCurrency': None,
'fiveYearAvgDividendYield': 1.13,
'fiftyTwoWeekLow': 118.86,
'bid': 154.94,
'tradeable': False,
'dividendYield': 0.0055,
'bidSize': 1100,
'dayHigh': 159.2799,
'regularMarketPrice': 155.515,
'preMarketPrice': 158.95,
'logo_url': 'https://logo.clearbit.com/apple.com',
'trailingPegRatio': 3.2017}
  • 本文作者:括囊无誉
  • 本文链接: python-11-yfinance-info/
  • 版权声明: 本博客所有文章均为原创作品,转载请注明出处!
------ 本文结束 ------
坚持原创文章分享,您的支持将鼓励我继续创作!