pythonで使用できる株価データ取得ライブラリのひとつに、yfinanceがあります。
使用例
トヨタの過去1年間の株価データを取得する。
import yfinance as yf
tk = yf.Ticker("7203.T")
hist = tk.history(period='1y')
実は、yfinanceは株価データの他に銘柄情報も取れます1。
本記事はyfinanceで取れる銘柄情報をまとめたものです。
取得可能な銘柄情報
取得方法
import yfinance as yf
# トヨタのTickerオブジェクトを作成
tk = yf.Ticker('7203.T')
# Tickerオブジェクトの全メソッドと属性を取得
all_attributes = dir(tk)
# プライベートメソッドや特殊メソッドを除外してAPIリストを作成
public_apis = [attr for attr in all_attributes if not attr.startswith('_')]
print("yfinance Ticker オブジェクトの公開API一覧:")
print("=" * 50)
for i, api in enumerate(public_apis, 1):
print(f"{i:2d}. {api}")
print(f"\n合計: {len(public_apis)} 個のAPI")
使用可能API一覧
| API Name | 説明 |
|---|---|
| actions | 配当や株式分割などの企業アクション |
| analyst_price_targets | アナリストの目標株価 |
| balance_sheet | 年次のバランスシート(貸借対照表)データ |
| balancesheet | balance_sheet の別名(エイリアス) |
| calendar | 決算発表などの重要な日程 |
| capital_gains | キャピタルゲイン情報(あれば) |
| cash_flow | 年次のキャッシュフロー計算書 |
| cashflow | cash_flow の別名 |
| dividends | 配当履歴 |
| earnings | 年次の収益報告 |
| earnings_dates | 今後および過去の決算発表日 |
| earnings_estimate | アナリストによる利益予測 |
| earnings_history | 過去の収益データ |
| eps_revisions | 1株あたり利益(EPS)の修正履歴 |
| eps_trend | EPS予測の傾向 |
| fast_info | 主要な株式情報の高速アクセス |
| financials | 年次の損益計算書 |
| funds_data | ファンドによる保有情報 |
| get_actions | 企業アクションを取得 |
| get_analyst_price_targets | アナリストの目標株価を取得 |
| get_balance_sheet | 年次のバランスシートを取得 |
| get_balancesheet | get_balance_sheet の別名 |
| get_calendar | 重要なイベント日程を取得 |
| get_capital_gains | キャピタルゲイン情報を取得 |
| get_cash_flow | 年次のキャッシュフローを取得 |
| get_cashflow | get_cash_flow の別名 |
| get_dividends | 配当履歴を取得 |
| get_earnings | 年次の収益データを取得 |
| get_earnings_dates | 決算発表日を取得 |
| get_earnings_estimate | EPSの予測を取得 |
| get_earnings_history | 過去の決算結果を取得 |
| get_eps_revisions | EPSの修正履歴を取得 |
| get_eps_trend | EPSの傾向データを取得 |
| get_fast_info | fast_infoを取得 |
| get_financials | 損益計算書を取得 |
| get_funds_data | ファンドの保有情報を取得 |
| get_growth_estimates | 成長予測を取得 |
| get_history_metadata | 株価履歴のメタデータを取得 |
| get_income_stmt | 損益計算書を取得 |
| get_incomestmt | get_income_stmt の別名 |
| get_info | ティッカー情報を取得 |
| get_insider_purchases | インサイダーによる購入データを取得 |
| get_insider_roster_holders | インサイダー保有者リストを取得 |
| get_insider_transactions | インサイダー取引履歴を取得 |
| get_institutional_holders | 機関投資家の保有情報を取得 |
| get_isin | ISINコードを取得 |
| get_major_holders | 主要株主を取得 |
| get_mutualfund_holders | ミューチュアルファンドの保有者情報を取得 |
| get_news | 最新ニュースを取得 |
| get_recommendations | アナリストの推奨情報を取得 |
| get_recommendations_summary | アナリストの推奨の要約 |
| get_revenue_estimate | 売上予測を取得 |
| get_sec_filings | SEC提出書類を取得 |
| get_shares | 株式データを取得 |
| get_shares_full | 株式の詳細な内訳を取得 |
| get_splits | 株式分割の履歴を取得 |
| get_sustainability | ESG/持続可能性の指標を取得 |
| get_upgrades_downgrades | 格付けの上昇・下降情報を取得 |
| growth_estimates | 成長見込みデータ |
| history | 過去の株価データ |
| history_metadata | 過去データのメタ情報 |
| income_stmt | 損益計算書 |
| incomestmt | income_stmt の別名 |
| info | 一般的な株式情報 |
| insider_purchases | インサイダーによる株購入 |
| insider_roster_holders | インサイダー保有者の一覧 |
| insider_transactions | インサイダー取引情報 |
| institutional_holders | 機関投資家の保有状況 |
| isin | ISIN識別子 |
| live | リアルタイムの市場データ |
| major_holders | 主要なステークホルダー |
| mutualfund_holders | ミューチュアルファンドの保有者 |
| news | 最新のニュース見出し |
| option_chain | 指定期日のオプションチェーン |
| options | オプションの満期日一覧 |
| quarterly_balance_sheet | 四半期のバランスシート |
| quarterly_balancesheet | quarterly_balance_sheet の別名 |
| quarterly_cash_flow | 四半期のキャッシュフロー |
| quarterly_cashflow | quarterly_cash_flow の別名 |
| quarterly_earnings | 四半期の収益 |
| quarterly_financials | 四半期の財務諸表 |
| quarterly_income_stmt | 四半期の損益計算書 |
| quarterly_incomestmt | quarterly_income_stmt の別名 |
| recommendations | アナリストの推奨情報 |
| recommendations_summary | アナリストの意見の要約 |
| revenue_estimate | 売上予測データ |
| sec_filings | SEC提出書類 |
| session | HTTPリクエストのセッションオブジェクト |
| shares | 株式情報 |
| splits | 株式分割履歴 |
| sustainability | サステナビリティの指標 |
| ticker | ティッカー記号 |
| ttm_cash_flow | 直近12ヶ月のキャッシュフロー |
| ttm_cashflow | ttm_cash_flow の別名 |
| ttm_financials | 直近12ヶ月の財務データ |
| ttm_income_stmt | 直近12ヶ月の損益計算書 |
| ttm_incomestmt | ttm_income_stmt の別名 |
| upgrades_downgrades | アナリストによる格上げ・格下げ |
| ws | 内部WebSocketまたはAPIクライアント |
損益計算書
年間損益計算書
取得方法
import yfinance as yf
tk = yf.Ticker("7203.T")
tk.income_stmt
出力例
取れるのは過去4年分までのようです。
jupyter notebookでの出力例:

四半期の損益計算書
取得方法
import yfinance as yf
tk = yf.Ticker("7203.T")
tk.quarterly_income_stmt
出力例
取れるのは過去1年分までのようです。
jupyter notebookでの出力例:

income_stmt、quarterly_income_stmtの両方とも出力される項目は同じで、下記の一覧の通りです。
項目一覧
| 英語項目名 | 日本語訳 |
|---|---|
| Tax Effect Of Unusual Items | 異常項目の税効果 |
| Tax Rate For Calcs | 計算用税率 |
| Normalized EBITDA | 正規化EBITDA |
| Total Unusual Items | 異常項目合計 |
| Total Unusual Items Excluding Goodwill | のれん除く異常項目合計 |
| Net Income From Continuing Operation Net Minority Interest | 継続事業純利益(少数株主持分控除後) |
| Reconciled Depreciation | 調整後減価償却費 |
| Reconciled Cost Of Revenue | 調整後売上原価 |
| EBITDA | EBITDA(利払・税引・償却前利益) |
| EBIT | EBIT(利払・税引前利益) |
| Net Interest Income | 純利息収入 |
| Interest Expense | 支払利息 |
| Interest Income | 受取利息 |
| Normalized Income | 正規化純利益 |
| Net Income From Continuing And Discontinued Operation | 継続・非継続事業純利益 |
| Total Expenses | 費用合計 |
| Total Operating Income As Reported | 報告ベース営業利益合計 |
| Diluted Average Shares | 希薄化後平均株数 |
| Basic Average Shares | 基本平均株数 |
| Diluted EPS | 希薄化後EPS(1株当たり利益) |
| Basic EPS | 基本EPS(1株当たり利益) |
| Diluted NI Availto Com Stockholders | 希薄化後普通株主帰属純利益 |
| Net Income Common Stockholders | 普通株主帰属純利益 |
| Net Income | 純利益 |
| Minority Interests | 少数株主持分 |
| Net Income Including Noncontrolling Interests | 非支配株主持分含む純利益 |
| Net Income Continuous Operations | 継続事業純利益 |
| Tax Provision | 法人税等 |
| Pretax Income | 税引前利益 |
| Other Income Expense | その他収益・費用 |
| Other Non Operating Income Expenses | その他営業外収益・費用 |
| Earnings From Equity Interest | 持分法による利益 |
| Gain On Sale Of Security | 有価証券売却益 |
| Net Non Operating Interest Income Expense | 営業外純利息収益・費用 |
| Interest Expense Non Operating | 営業外支払利息 |
| Interest Income Non Operating | 営業外受取利息 |
| Operating Income | 営業利益 |
| Operating Expense | 営業費用 |
| Selling General And Administration | 販売費及び一般管理費 |
| Gross Profit | 売上総利益 |
| Cost Of Revenue | 売上原価 |
| Total Revenue | 売上高 |
| Operating Revenue | 営業収益 |