yfinance
できること
このスキルは、Yahoo Financeから株式、ETF、指数の価格の履歴と企業のデータを取得します。無料の市場データが必要なアナリストや学生向けです。
使う場面
- ✓米国、香港、カナダの株の日次の価格履歴がほしいとき。
- ✓Yahoo Financeから、企業情報、財務諸表、オプションチェーンを取得したいとき。
- ✓有料のアカウントを設定せずに、バックテスト用の無料の市場データがほしいとき。
スキルのリンク
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/yfinance/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Microsoftの5年分の日次の株価と、直近の四半期の財務諸表を取得してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、サインアップなしで、Pythonのラッパーまたはビルトインのローダーを使ってYahoo Financeのデータを使います。通常の価格データでは、不正な行を整える標準のローダーを通します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
yfinance
Overview
yfinance is an open-source Python wrapper for Yahoo Finance, providing global market data (US, HK, and Canadian stocks, ETFs, indices) including historical and real-time quotes. Completely free, no registration or API key required.
The project has a built-in yfinance DataLoader (backtest/loaders/yfinance_loader.py). When backtesting, set source: "yfinance" or source: "auto" to invoke it automatically.
For OHLCV bars in agent/swarm work, prefer the get_market_data tool when it is available. It routes through the project loader layer, normalizes symbols, removes malformed OHLC rows, and returns strict JSON. Use direct yfinance calls mainly for data outside OHLCV coverage such as company info, financial statements, options, holders, and insider transactions.
Deep Yahoo Interfaces (references/)
Beyond the yfinance package, the project ships a built-in Yahoo public-API
client (backtest.loaders.yahoo_client) and two read-only agent tools that
sit on top of it. These reach Yahoo's own unauthenticated JSON endpoints
directly via requests (no yfinance install needed), share one throttled
HTTP gate (Yahoo rate-limits by source IP), and handle the cookie+crumb
handshake automatically. Each interface has its own reference doc — read the
one you need rather than loading them all:
| Doc | Covers |
|---|---|
| yahoo_client.get_chart | Direct v8 OHLCV bars (range or epoch window) |
| yahoo_client.get_quote_summary | v10 quoteSummary modules (key stats, financials, ownership) |
| yahoo_client.get_options | v7 option chain (expirations + calls/puts) |
| yahoo_client.search | v1 instrument search by ticker/name |
| get_options_chain tool | Agent tool: US options ladder envelope |
| get_stock_profile tool | Agent tool: company profile/estimates/ownership envelope |
Path convention: every link above is written relative to this document (
references/...), the form GitHub resolves when the file is opened in a browser.read_fileresolves the same string against the skill that owns it, so the agent and a human reader reach one file. Reuse the relative form for any new reference docs, and keep reference paths unique across skills: a path two skills both carry is reported as ambiguous rather than guessed.
The Yahoo client uses the project ticker convention (AAPL.US → AAPL,
00700.HK → 0700.HK, TD.TO and PNG.V pass through); see the
Ticker Format Conversion table below — the same
rules apply across all of the interfaces above.
Quick Start
Preferred OHLCV tool call:
{
"codes": ["AAPL.US", "700.HK", "TD.TO", "PNG.V"],
"start_date": "2025-01-01",
"end_date": "2026-01-01",
"source": "yfinance",
"interval": "1D"
}
If you must write a Python script for OHLCV, use the DataLoader instead of raw yf.download:
from backtest.loaders.registry import get_loader_cls_with_fallback
loader = get_loader_cls_with_fallback("yfinance")()
data = loader.fetch(
["AAPL.US", "700.HK", "TD.TO", "PNG.V"],
"2025-01-01",
"2026-01-01",
interval="1D",
)
for symbol, df in data.items():
print(symbol, df.tail())
Ticker Format Conversion
The project uses a unified ticker format. The DataLoader automatically converts to yfinance format:
| Project Format | yfinance Format | Market |
|---|---|---|
AAPL.US |
AAPL |
US stock |
MSFT.US |
MSFT |
US stock |
700.HK |
0700.HK |
HK stock |
9988.HK |
9988.HK |
HK stock |
TD.TO |
TD.TO |
Toronto Stock Exchange stock |
PNG.V |
PNG.V |
TSX Venture stock |
SPY.US |
SPY |
US ETF |
Rules:
- US stocks: strip the
.USsuffix → use the raw ticker - HK stocks: keep
.HK, pad the number to 4 digits (700→0700) - Canadian stocks: keep
.TO(TSX) or.V(TSXV) unchanged
Supported Data Types
1. Historical OHLCV
Prefer get_market_data for OHLCV whenever the tool is available:
{
"codes": ["AAPL.US", "MSFT.US", "GOOGL.US"],
"start_date": "2025-01-01",
"end_date": "2026-01-01",
"source": "yfinance",
"interval": "1D",
"max_rows": 250
}
For script-
よくある質問
APIキーが必要ですか?
いいえ。Yahoo Financeのデータは無料で、登録もキーも不要です。
どの市場を対象としていますか?
米国、香港、カナダの株式、ETF、指数を対象としています。
Yahooのデータは常に完全ですか?
無料のソースには欠けやエラーがあることがあるため、信頼する前にデータを確認してください。
詳細
作者による元の説明
yfinance global market data interface — retrieve OHLCV and research data for US, HK, and Canadian stocks, ETFs, and indices via Yahoo Finance. Free, no API key required.
repo: HKUDS/Vibe-Trading
人気
- GitHubのスター
- 37k
- ランキング
- #7568
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
vibe-trading
37kバックテスト、ファクター分析、オプション価格、多くの市場にまたがる市場データを含む、金融リサーチの完全なツールキットをエージェントに与えます。
adr-hshare
37k中国企業が複数の市場に上場している価格差、例えば米国のADRと香港株の差を比べる方法をエージェントに示します。
akshare
37kエージェントが、APIキーなしで、中国と世界の株式、先物、外国為替、経済指標の無料の市場データを取得できるよう支援します。
alpha-zoo
37k既製のストックファクターのライブラリを閲覧し、選んだ市場で一群のファクターがリターンをどれだけ予測するかを検証できるよう支援します。
似ているスキル
tavily
394kTavilyでウェブを検索し、特定のWebページから本文を取り出すようエージェントを支援します。深さ、ドメイン、日付のオプションも使えます。
blogwatcher
394kブログやRSS・Atomフィードを追跡し、新しい記事を確認して、読んだ記事に印を付けるようエージェントを支援します。
data-scraper-agent
280kエージェントが公開されているさまざまな情報源からデータを自動で収集できるよう支援します。スケジュール実行、情報の補強、結果の保存が可能です。オンラインデータの監視や追跡に役立ちます。