yfinance-3.py
· 1.7 KiB · Python
Sin formato
import yfinance as yf
msft = yf.Ticker("MSFT")
# get all stock info
msft.info
# get historical market data
hist = msft.history(period="1mo")
# show meta information about the history (requires history() to be called first)
msft.history_metadata
# show actions (dividends, splits, capital gains)
msft.actions
msft.dividends
msft.splits
msft.capital_gains # only for mutual funds & etfs
# show share count
msft.get_shares_full(start="2022-01-01", end=None)
# show financials:
msft.calendar
msft.sec_filings
# - income statement
msft.income_stmt
msft.quarterly_income_stmt
# - balance sheet
msft.balance_sheet
msft.quarterly_balance_sheet
# - cash flow statement
msft.cashflow
msft.quarterly_cashflow
# see `Ticker.get_income_stmt()` for more options
# show holders
msft.major_holders
msft.institutional_holders
msft.mutualfund_holders
msft.insider_transactions
msft.insider_purchases
msft.insider_roster_holders
msft.sustainability
# show recommendations
msft.recommendations
msft.recommendations_summary
msft.upgrades_downgrades
# show analysts data
msft.analyst_price_targets
msft.earnings_estimate
msft.revenue_estimate
msft.earnings_history
msft.eps_trend
msft.eps_revisions
msft.growth_estimates
# Show future and historic earnings dates, returns at most next 4 quarters and last 8 quarters by default.
# Note: If more are needed use msft.get_earnings_dates(limit=XX) with increased limit argument.
msft.earnings_dates
# show ISIN code - *experimental*
# ISIN = International Securities Identification Number
msft.isin
# show options expirations
msft.options
# show news
msft.news
# get option chain for specific expiration
opt = msft.option_chain('YYYY-MM-DD')
# data available via: opt.calls, opt.puts
1 | import yfinance as yf |
2 | |
3 | msft = yf.Ticker("MSFT") |
4 | |
5 | # get all stock info |
6 | msft.info |
7 | |
8 | # get historical market data |
9 | hist = msft.history(period="1mo") |
10 | |
11 | # show meta information about the history (requires history() to be called first) |
12 | msft.history_metadata |
13 | |
14 | # show actions (dividends, splits, capital gains) |
15 | msft.actions |
16 | msft.dividends |
17 | msft.splits |
18 | msft.capital_gains # only for mutual funds & etfs |
19 | |
20 | # show share count |
21 | msft.get_shares_full(start="2022-01-01", end=None) |
22 | |
23 | # show financials: |
24 | msft.calendar |
25 | msft.sec_filings |
26 | # - income statement |
27 | msft.income_stmt |
28 | msft.quarterly_income_stmt |
29 | # - balance sheet |
30 | msft.balance_sheet |
31 | msft.quarterly_balance_sheet |
32 | # - cash flow statement |
33 | msft.cashflow |
34 | msft.quarterly_cashflow |
35 | # see `Ticker.get_income_stmt()` for more options |
36 | |
37 | # show holders |
38 | msft.major_holders |
39 | msft.institutional_holders |
40 | msft.mutualfund_holders |
41 | msft.insider_transactions |
42 | msft.insider_purchases |
43 | msft.insider_roster_holders |
44 | |
45 | msft.sustainability |
46 | |
47 | # show recommendations |
48 | msft.recommendations |
49 | msft.recommendations_summary |
50 | msft.upgrades_downgrades |
51 | |
52 | # show analysts data |
53 | msft.analyst_price_targets |
54 | msft.earnings_estimate |
55 | msft.revenue_estimate |
56 | msft.earnings_history |
57 | msft.eps_trend |
58 | msft.eps_revisions |
59 | msft.growth_estimates |
60 | |
61 | # Show future and historic earnings dates, returns at most next 4 quarters and last 8 quarters by default. |
62 | # Note: If more are needed use msft.get_earnings_dates(limit=XX) with increased limit argument. |
63 | msft.earnings_dates |
64 | |
65 | # show ISIN code - *experimental* |
66 | # ISIN = International Securities Identification Number |
67 | msft.isin |
68 | |
69 | # show options expirations |
70 | msft.options |
71 | |
72 | # show news |
73 | msft.news |
74 | |
75 | # get option chain for specific expiration |
76 | opt = msft.option_chain('YYYY-MM-DD') |
77 | # data available via: opt.calls, opt.puts |