python yfinance 下载金融数据,股票数据
起因, 目的:
代码比较少,但是估计很常用。
需要开启全局代理:
代码
import yfinance as yf
# 股票的名称
ticker = 'WBC.AX'
start = '2009-07-01'
end = '2024-06-30'
# 每周
wbc = yf.download(ticker, start, end, ignore_tz = True, interval = '1wk')
wbc
# 每日
wbc_daily = yf.download(ticker, start, end, ignore_tz = True)
wbc_daily.tail(10)