yahoo-finance by gracefullight/stock-checker
npx skills add https://github.com/gracefullight/stock-checker --skill yahoo-finance一个使用 yfinance 从 Yahoo Finance 获取全面股票数据的 Python 命令行工具。
此脚本需要 uv —— 一个极快的 Python 包管理器。检查是否已安装:
uv --version
如果未安装,请使用以下方法之一进行安装:
curl -LsSf https://astral.sh/uv/install.sh | sh
brew install uv
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
pip install uv
安装后,重启终端或运行:
source ~/.bashrc # 在 macOS 上可能是 ~/.zshrc
yf 脚本使用 PEP 723 内联脚本元数据 —— 依赖项在首次运行时自动安装。
# 赋予可执行权限
chmod +x /path/to/skills/yahoo-finance/yf
# 可选:创建符号链接到 PATH 以便全局访问
ln -sf /path/to/skills/yahoo-finance/yf /usr/local/bin/yf
首次运行将安装依赖项 (yfinance, rich) 到 uv 的缓存中。后续运行将是即时的。
yf AAPL # price 的简写形式
yf price AAPL
yf quote MSFT
yf fundamentals NVDA
显示:市盈率、每股收益、市值、利润率、净资产收益率/总资产收益率、分析师目标价。
yf earnings TSLA
显示:下次财报发布日期、每股收益预期、财报历史及预期差。
yf profile GOOGL
显示:行业、子行业、员工数、网站、地址、业务描述。
yf dividends KO
显示:股息率/股息收益率、除息日、派息比率、近期股息历史。
yf ratings AAPL
显示:买入/持有/卖出分布、平均评级、近期评级上调/下调。
yf options SPY
显示:接近平值的看涨和看跌期权,包含行权价、买价/卖价、成交量、未平仓合约、隐含波动率。
yf history GOOGL 1mo # 1 个月历史数据
yf history TSLA 1y # 1 年历史数据
yf history BTC-USD 5d # 5 天历史数据
时间范围:1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max
yf compare AAPL,MSFT,GOOGL
yf compare RELIANCE.NS,TCS.NS,INFY.NS
并排比较价格、涨跌幅、52周价格区间、市值。
yf search "reliance industries"
yf search "bitcoin"
yf search "s&p 500 etf"
# 快速查询价格
yf AAPL
# 获取估值指标
yf fundamentals NVDA
# 下次财报日期 + 历史
yf earnings TSLA
# SPY 的期权链
yf options SPY
# 比较科技巨头
yf compare AAPL,MSFT,GOOGL,META,AMZN
# 查找印度股票
yf search "infosys"
# 可口可乐的股息信息
yf dividends KO
# 苹果的分析师评级
yf ratings AAPL
请按照上面的说明安装 uv。
Yahoo Finance 可能会对过多的请求进行速率限制。请等待几分钟后重试。
yf search "公司名称"每周安装量
2.3K
代码仓库
GitHub 星标数
12
首次出现
2026年1月27日
安全审计
已安装于
opencode2.1K
gemini-cli2.0K
codex2.0K
github-copilot2.0K
cursor2.0K
kimi-cli2.0K
A Python CLI for fetching comprehensive stock data from Yahoo Finance using yfinance.
The script requires uv - an extremely fast Python package manager. Check if it's installed:
uv --version
If not installed, install it using one of these methods:
curl -LsSf https://astral.sh/uv/install.sh | sh
brew install uv
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
pip install uv
After installation, restart your terminal or run:
source ~/.bashrc # or ~/.zshrc on macOS
The yf script uses PEP 723 inline script metadata - dependencies are auto-installed on first run.
# Make executable
chmod +x /path/to/skills/yahoo-finance/yf
# Optionally symlink to PATH for global access
ln -sf /path/to/skills/yahoo-finance/yf /usr/local/bin/yf
First run will install dependencies (yfinance, rich) to uv's cache. Subsequent runs are instant.
yf AAPL # shorthand for price
yf price AAPL
yf quote MSFT
yf fundamentals NVDA
Shows: PE ratios, EPS, market cap, margins, ROE/ROA, analyst targets.
yf earnings TSLA
Shows: Next earnings date, EPS estimates, earnings history with surprises.
yf profile GOOGL
Shows: Sector, industry, employees, website, address, business description.
yf dividends KO
Shows: Dividend rate/yield, ex-date, payout ratio, recent dividend history.
yf ratings AAPL
Shows: Buy/hold/sell distribution, mean rating, recent upgrades/downgrades.
yf options SPY
Shows: Near-the-money calls and puts with strike, bid/ask, volume, OI, IV.
yf history GOOGL 1mo # 1 month history
yf history TSLA 1y # 1 year
yf history BTC-USD 5d # 5 days
Ranges: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max
yf compare AAPL,MSFT,GOOGL
yf compare RELIANCE.NS,TCS.NS,INFY.NS
Side-by-side comparison with price, change, 52W range, market cap.
yf search "reliance industries"
yf search "bitcoin"
yf search "s&p 500 etf"
# Quick price check
yf AAPL
# Get valuation metrics
yf fundamentals NVDA
# Next earnings date + history
yf earnings TSLA
# Options chain for SPY
yf options SPY
# Compare tech giants
yf compare AAPL,MSFT,GOOGL,META,AMZN
# Find Indian stocks
yf search "infosys"
# Dividend info for Coca-Cola
yf dividends KO
# Analyst ratings for Apple
yf ratings AAPL
Install uv using the instructions above.
Yahoo Finance may rate limit excessive requests. Wait a few minutes and try again.
yf search "company name"Weekly Installs
2.3K
Repository
GitHub Stars
12
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
opencode2.1K
gemini-cli2.0K
codex2.0K
github-copilot2.0K
cursor2.0K
kimi-cli2.0K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装