yfinance
Fungsinya
Skill ini mengambil riwayat harga dan data perusahaan untuk saham, ETF, dan indeks dari Yahoo Finance. Skill ini untuk analis dan mahasiswa yang membutuhkan data pasar gratis.
Kapan dipakai
- โSaat Anda ingin riwayat harga harian untuk saham AS, Hong Kong, atau Kanada.
- โSaat Anda membutuhkan informasi perusahaan, laporan keuangan, atau rantai opsi dari Yahoo Finance.
- โSaat Anda ingin data pasar gratis untuk backtest tanpa menyiapkan akun berbayar.
Link skill
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/yfinance/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โAmbil harga harian Microsoft selama lima tahun dan laporan keuangan kuartalan terbarunya.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill ini memakai data Yahoo Finance melalui pembungkus Python atau pemuat bawaan, dan tidak memerlukan pendaftaran. Untuk data harga biasa, skill ini melewati pemuat standar yang merapikan baris yang rusak.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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-
Pertanyaan umum
Apakah perlu kunci API?
Tidak. Data Yahoo Finance gratis, dan skill ini tidak memerlukan pendaftaran atau kunci.
Pasar mana saja yang dicakup?
Skill ini mencakup saham, ETF, dan indeks AS, Hong Kong, dan Kanada.
Apakah data Yahoo selalu lengkap?
Sumber gratis bisa memiliki celah atau kesalahan, jadi periksa datanya sebelum mengandalkannya.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 37k
- Peringkat
- #7568
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- โฆ
Skill lain dari repositori ini
vibe-trading
37kMemberi agent Anda perangkat riset keuangan lengkap, mencakup backtest, analisis faktor, penetapan harga opsi, dan data pasar di banyak pasar.
adr-hshare
37kMenunjukkan kepada agent Anda cara membandingkan harga perusahaan Tiongkok yang terdaftar di beberapa pasar, seperti ADR AS dan saham Hong Kong.
akshare
37kMemungkinkan agent Anda mengambil data pasar gratis untuk saham Tiongkok dan global, futures, forex, dan indikator ekonomi, tanpa perlu kunci API.
alpha-zoo
37kMemungkinkan agent Anda menelusuri pustaka faktor saham siap pakai dan menguji seberapa baik sekumpulan faktor itu memprediksi imbal hasil di pasar pilihan.
Skill serupa
tavily
394kMembantu agent Anda mencari di web dengan Tavily dan mengambil teks dari halaman web tertentu, dengan opsi kedalaman, domain, dan tanggal.
blogwatcher
394kMemungkinkan agent Anda mengikuti blog dan feed RSS atau Atom, memeriksanya untuk artikel baru, dan menandai artikel yang sudah Anda baca.
data-scraper-agent
280kMembantu agent mengumpulkan data otomatis dari sumber publik. Bisa dijadwalkan, memperkaya informasi, dan menyimpan hasil. Berguna untuk memantau data online.