Skip to content

建立 2026-09-15 更新 2026-09-15

基本面與財報

價量告訴你市場成交;財報與 info 告訴你公司帳上長什麼樣子。yfinance 把 Yahoo 上常見的基本面頁面收成 DataFrame 或 dict。

本頁只講最常用的入口。欄位名稱與 Yahoo 網站一致,缺值、單位(千元/百萬)要以實際表格為準,不要假設每檔都有完整歷史。

公司摘要:info 與 fast_info

import yfinance as yf

msft = yf.Ticker("MSFT")
info = msft.info
print(info.get("shortName"), info.get("sector"), info.get("marketCap"))

info 是大型 dict(產業、市值、本益比、簡介等),第一次讀會打較多請求。只要報價與幾個關鍵數字,可先試 fast_info,負載較小。

print(msft.fast_info)

三大報表

屬性 內容 季報
income_stmt / financials 損益表 quarterly_income_stmt
balance_sheet 資產負債表 quarterly_balance_sheet
cashflow 現金流量表 quarterly_cashflow
annual = msft.income_stmt
quarter = msft.quarterly_income_stmt

也可用方法指定頻率與格式:

msft.get_income_stmt(freq="yearly", pretty=True)
msft.get_balance_sheet(freq="quarterly")
msft.get_cash_flow(freq="yearly")

freq 依方法而異:損益表還支援 "trailing"(近十二個月)。另有 ttm_income_stmtttm_cashflow 等 TTM 屬性。

列是會計科目、欄是期間,方向與 Excel 財報常見排法相同,用 pandas 選列即可:

rev = annual.loc["Total Revenue"]  # 科目名稱以實際 index 為準

資料品質

免費來源可能缺季、科目翻譯不一致,或與公司年報有出入。正式研究請交叉核對 10-K/年報,不要只信 Yahoo 一欄數字。

分析師與估值

msft.analyst_price_targets
msft.recommendations
msft.upgrades_downgrades
msft.earnings_dates
msft.valuation

這些同樣來自 Yahoo 彙整,不是即時券商內部研究。

ETF 與基金

標的是 ETF 或共同基金時,用 funds_data

spy = yf.Ticker("SPY").funds_data
spy.description
spy.top_holdings
spy.sector_weightings
spy.fund_overview

官方範例見 Ticker and Tickers

推薦影音

Analyzing Alpha 從 Tickerhistory() 講到基本面與選擇權,長度適中,可與本頁財報、以及 股利、分割與選擇權 一起看。