yfinance-data by himself65/finance-skills
npx skills add https://github.com/himself65/finance-skills --skill yfinance-data包含 Shell 命令
此技能包含可能执行系统命令的 shell 命令指令(!command``)。安装前请仔细审查。
使用 yfinance Python 库从 Yahoo Finance 获取金融和市场数据。
重要提示:yfinance 与 Yahoo, Inc. 无关。数据仅供研究和教育用途。
当前环境状态:
!`python3 -c "import yfinance; print('yfinance ' + yfinance.__version__ + ' installed')" 2>/dev/null || echo "YFINANCE_NOT_INSTALLED"`
如果显示 YFINANCE_NOT_INSTALLED,请在运行任何代码前安装它:
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])
如果 yfinance 已安装,请跳过安装步骤并直接继续。
将用户的请求与下面的一个或多个数据类别匹配,然后使用 references/api_reference.md 中对应的代码。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 用户请求 | 数据类别 | 主要方法 |
|---|---|---|
| 股票价格、报价 | 当前价格 | ticker.info 或 ticker.fast_info |
| 价格历史、图表数据 | 历史 OHLCV 数据 | ticker.history() 或 yf.download() |
| 资产负债表 | 财务报表 | ticker.balance_sheet |
| 利润表、营收 | 财务报表 | ticker.income_stmt |
| 现金流量表 | 财务报表 | ticker.cashflow |
| 股息 | 公司行为 | ticker.dividends |
| 股票拆分 | 公司行为 | ticker.splits |
| 期权链、看涨/看跌期权 | 期权数据 | ticker.option_chain() |
| 盈利、每股收益 | 分析数据 | ticker.earnings_history |
| 分析师目标价 | 分析数据 | ticker.analyst_price_targets |
| 推荐、评级 | 分析数据 | ticker.recommendations |
| 升级/降级 | 分析数据 | ticker.upgrades_downgrades |
| 机构持股人 | 所有权数据 | ticker.institutional_holders |
| 内部人交易 | 所有权数据 | ticker.insider_transactions |
| 公司概览、行业 | 一般信息 | ticker.info |
| 比较多只股票 | 批量下载 | yf.download() |
| 筛选股票 | 筛选器 | yf.Screener + yf.EquityQuery |
| 行业/产业数据 | 市场数据 | yf.Sector / yf.Industry |
| 新闻 | 新闻 | ticker.news |
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])
import yfinance as yf
ticker = yf.Ticker("AAPL")
# ... 使用参考中的适当方法
yf.download() — 它通过多线程处理速度更快ticker.options 然后再调用 ticker.option_chain(date)quarterly_ 前缀:ticker.quarterly_income_stmt, ticker.quarterly_balance_sheet, ticker.quarterly_cashflow.to_string() 或 .to_markdown() 以提高可读性,或选择关键列| 期间 | 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max |
|---|---|
| 间隔 | 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, |
获取数据后,清晰地呈现它:
如果用户似乎想要图表或可视化,请结合适当的可视化方法(例如,生成 HTML 图表或描述趋势)。
references/api_reference.md — 完整的 yfinance API 参考,包含每个数据类别的代码示例当需要确切的方法签名或边缘情况处理时,请阅读参考文件。
每周安装数
174
代码仓库
GitHub 星标数
489
首次出现
11 天前
安全审计
安装于
codex160
gemini-cli159
cursor158
opencode158
github-copilot157
kimi-cli157
Contains Shell Commands
This skill contains shell command directives (!command``) that may execute system commands. Review carefully before installing.
Fetches financial and market data from Yahoo Finance using the yfinance Python library.
Important : yfinance is not affiliated with Yahoo, Inc. Data is for research and educational purposes.
Current environment status:
!`python3 -c "import yfinance; print('yfinance ' + yfinance.__version__ + ' installed')" 2>/dev/null || echo "YFINANCE_NOT_INSTALLED"`
If YFINANCE_NOT_INSTALLED, install it before running any code:
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])
If yfinance is already installed, skip the install step and proceed directly.
Match the user's request to one or more data categories below, then use the corresponding code from references/api_reference.md.
| User Request | Data Category | Primary Method |
|---|---|---|
| Stock price, quote | Current price | ticker.info or ticker.fast_info |
| Price history, chart data | Historical OHLCV | ticker.history() or yf.download() |
| Balance sheet | Financial statements | ticker.balance_sheet |
| Income statement, revenue | Financial statements | ticker.income_stmt |
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])
import yfinance as yf
ticker = yf.Ticker("AAPL")
# ... use the appropriate method from the reference
yf.download() for multi-ticker comparisons — it's faster with multi-threadingticker.options before calling ticker.option_chain(date)quarterly_ prefix: ticker.quarterly_income_stmt, ticker.quarterly_balance_sheet, ticker.quarterly_cashflow.to_string() or for readability, or select key columns| Periods | 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max |
|---|
After fetching data, present it clearly:
If the user seems to want a chart or visualization, combine with an appropriate visualization approach (e.g., generate an HTML chart or describe the trend).
references/api_reference.md — Complete yfinance API reference with code examples for every data categoryRead the reference file when you need exact method signatures or edge case handling.
Weekly Installs
174
Repository
GitHub Stars
489
First Seen
11 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex160
gemini-cli159
cursor158
opencode158
github-copilot157
kimi-cli157
DOCX文件创建、编辑与分析完整指南 - 使用docx-js、Pandoc和Python脚本
51,800 周安装
ULTRAQA 自主质量保证循环工具:自动化测试、构建、代码规范检查与修复
218 周安装
Vuetify0 无头组件库 - Vue 3 组合式函数与无样式UI构建块
219 周安装
AWS Serverless 开发指南:Lambda 函数与 API Gateway 集成模式最佳实践
216 周安装
Simplify代码简化工具 - 提升代码清晰度、一致性和可维护性的AI助手
222 周安装
GitHub CLI (gh) 使用指南:高效管理仓库、PR、议题与API调用
212 周安装
Cheerio HTML解析教程:Node.js网页抓取与DOM操作指南
214 周安装
3mo| Cash flow | Financial statements | ticker.cashflow |
| Dividends | Corporate actions | ticker.dividends |
| Stock splits | Corporate actions | ticker.splits |
| Options chain, calls, puts | Options data | ticker.option_chain() |
| Earnings, EPS | Analysis | ticker.earnings_history |
| Analyst price targets | Analysis | ticker.analyst_price_targets |
| Recommendations, ratings | Analysis | ticker.recommendations |
| Upgrades/downgrades | Analysis | ticker.upgrades_downgrades |
| Institutional holders | Ownership | ticker.institutional_holders |
| Insider transactions | Ownership | ticker.insider_transactions |
| Company overview, sector | General info | ticker.info |
| Compare multiple stocks | Bulk download | yf.download() |
| Screen/filter stocks | Screener | yf.Screener + yf.EquityQuery |
| Sector/industry data | Market data | yf.Sector / yf.Industry |
| News | News | ticker.news |
.to_markdown()| Intervals | 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo |