modify scripts
This commit is contained in:
24
src/sample/yh_finace.py
Normal file
24
src/sample/yh_finace.py
Normal file
@ -0,0 +1,24 @@
|
||||
import yfinance as yf
|
||||
|
||||
# 创建一个 Ticker 对象来表示苹果公司
|
||||
apple = yf.Ticker("PDD")
|
||||
|
||||
# 获取季度利润表
|
||||
quarterly_income_stmt = apple.quarterly_income_stmt
|
||||
print("季度利润表:")
|
||||
print(quarterly_income_stmt)
|
||||
|
||||
# 获取季度资产负债表
|
||||
quarterly_balance_sheet = apple.get_balance_sheet(freq="quarterly")
|
||||
print("\n季度资产负债表:")
|
||||
print(quarterly_balance_sheet)
|
||||
|
||||
# 获取季度现金流量表
|
||||
quarterly_cashflow = apple.quarterly_cashflow
|
||||
print("\n季度现金流量表:")
|
||||
print(quarterly_cashflow)
|
||||
|
||||
# 获取关键财务指标示例:获取市盈率(PE Ratio)
|
||||
info = apple.info
|
||||
pe_ratio = info.get('trailingPE')
|
||||
print(f"\n市盈率 (PE Ratio): {pe_ratio}")
|
||||
Reference in New Issue
Block a user