본문으로 건너뛰기
cccskills
무료GitHub에 공개

yfinance

Retrieve price and trading volume data for US, Hong Kong, and Canadian stocks, ETFs, and indices through Yahoo Finance. Also gather company profiles, financial statements, dividends, and ownership data for market research and historical strategy testing.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

연동 도구Yahoo Finance
설치 방법 보기

이럴 때 유용합니다

  • Collect historical prices across several stock markets
  • Review company financial statements and ownership
  • Check dividend and stock split histories
  • Prepare market data for historical strategy testing

포함된 파일(7)

  • SKILL.md8.8 KB
  • references/tool_get_options_chain.md2.8 KB
  • references/tool_get_stock_profile.md3.4 KB
  • references/yahoo_client_get_chart.md2.9 KB
  • references/yahoo_client_get_options.md2.8 KB
  • references/yahoo_client_get_quote_summary.md3.2 KB
  • references/yahoo_client_search.md1.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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:

DocCovers
yahoo_client.get_chartDirect v8 OHLCV bars (range or epoch window)
yahoo_client.get_quote_summaryv10 quoteSummary modules (key stats, financials, ownership)
yahoo_client.get_optionsv7 option chain (expirations + calls/puts)
yahoo_client.searchv1 instrument search by ticker/name
get_options_chain toolAgent tool: US options ladder envelope
get_stock_profile toolAgent 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_file resolves 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 Formatyfinance FormatMarket
AAPL.USAAPLUS stock
MSFT.USMSFTUS stock
700.HK0700.HKHK stock
9988.HK9988.HKHK stock
TD.TOTD.TOToronto Stock Exchange stock
PNG.VPNG.VTSX Venture stock
SPY.USSPYUS ETF

Rules:

  • US stocks: strip the .US suffix → 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-based OHLCV analysis, use the loader:

from backtest.loaders.registry import get_loader_cls_with_fallback

loader = get_loader_cls_with_fallback("yfinance")()

# Single stock
single = loader.fetch(["AAPL.US"], "2025-01-01", "2026-01-01", interval="1D")

# Specific interval
hourly = loader.fetch(["AAPL.US"], "2026-03-01", "2026-03-30", interval="1H")

Supported intervals:

  • Minute-level: 1m, 2m, 5m, 15m, 30m, 60m, 90m
  • Hourly: 1h
  • Daily and above: 1d, 5d, 1wk, 1mo, 3mo

Minute data limits:

  • 1m: up to 7 days of history
  • 2m/5m/15m/30m/60m/90m: up to 60 days
  • 1h: up to 730 days
  • 1d and above: unlimited

2. Company Info

ticker = yf.Ticker("AAPL")

info = ticker.info
print(f"Company: {info.get('longName')}")
print(f"Industry: {info.get('industry')}")
print(f"Market cap: {info.get('marketCap')}")
print(f"PE: {info.get('trailingPE')}")
print(f"EPS: {info.get('trailingEps')}")
print(f"Dividend yield: {info.get('dividendYield')}")

3. Financial Statements

ticker = yf.Ticker("AAPL")

# Income statement (annual)
income = ticker.financials
# Income statement (quarterly)
income_q = ticker.quarterly_financials

# Balance sheet
balance = ticker.balance_sheet

# Cash flow statement
cashflow = ticker.cashflow

# Earnings data
earnings = ticker.earnings

4. Dividends and Splits

ticker = yf.Ticker("AAPL")

# Dividend history
dividends = ticker.dividends

# Stock split history
splits = ticker.splits

# All corporate actions
actions = ticker.actions

5. Institutional Holdings

ticker = yf.Ticker("AAPL")

# Institutional holders
holders = ticker.institutional_holders

# Major holders summary
major = ticker.major_holders

# Insider transactions
insider = ticker.insider_transactions

6. Indices and ETFs

# Major indices
sp500 = yf.download("^GSPC", start="2025-01-01", end="2026-01-01", progress=False)  # S&P 500
nasdaq = yf.download("^IXIC", start="2025-01-01", end="2026-01-01", progress=False)  # NASDAQ
hsi = yf.download("^HSI", start="2025-01-01", end="2026-01-01", progress=False)      # Hang Seng Index

# ETFs
spy = yf.download("SPY", start="2025-01-01", end="2026-01-01", progress=False)
qqq = yf.download("QQQ", start="2025-01-01", end="2026-01-01", progress=False)

7. FX Rates

# Currency pairs
usdcny = yf.download("CNY=X", start="2025-01-01", end="2026-01-01", progress=False)
usdhkd = yf.download("HKD=X", start="2025-01-01", end="2026-01-01", progress=False)
eurusd = yf.download("EURUSD=X", start="2025-01-01", end="2026-01-01", progress=False)

Backtest Usage

config.json Example

{
  "source": "yfinance",
  "codes": ["AAPL.US", "MSFT.US"],
  "start_date": "2020-01-01",
  "end_date": "2026-03-30",
  "initial_cash": 1000000,
  "commission": 0.001,
  "extra_fields": null
}

Cross-Market Auto Mode

{
  "source": "auto",
  "codes": ["000001.SZ", "AAPL.US", "700.HK", "BTC-USDT"],
  "start_date": "2024-01-01",
  "end_date": "2026-03-30",
  "initial_cash": 1000000,
  "commission": 0.001,
  "extra_fields": null
}

source: "auto" routes automatically by ticker format: A-shares → the China fallback chain, HK stocks → the HK chain, Canadian .TO/.V stocks → Yahoo/yfinance, and crypto → OKX.

Notes

  • Free, no API key: yfinance scrapes Yahoo Finance public data — no registration needed
  • Rate limits: high-frequency requests may trigger temporary Yahoo bans — prefer batch downloads over per-ticker loops
  • Minute data range: limited by Yahoo Finance (see table above)
  • HK tickers: Yahoo Finance uses 4-digit numbers + .HK; pad with leading zeros where needed
  • Adjustment: auto_adjust=True (default) returns forward-adjusted prices; the project loader uses auto_adjust=False
  • Timezone: returned data includes timezone info; the DataLoader strips it automatically
  • extra_fields not supported: yfinance via the backtest loader returns OHLCV only; PE/PB and other fundamentals require separate yf.Ticker().info calls
  • Comparison with Tushare: Tushare covers deep A-share data (financials, fund flows, block trades, etc.); yfinance covers global markets but with less depth

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Compare a Chinese company's US depositary receipts, Hong Kong shares, and mainland shares after adjusting for exchange rates and share ratios. Analyze pricing gaps, valuation differences, and delisting risks to support research into its different listings.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Compare A-share and H-share pricing gaps
  • Measure ADR premiums against Hong Kong shares
  • Review US delisting risks and Hong Kong listing alternatives
HKUDS/Vibe-Trading3.6만2026년 10월 21일 업데이트

akshare

무료

Retrieve stock prices, futures quotes, exchange rates, and economic indicators with the free Python library AKShare. The skill explains market-specific functions, symbol formats, and data preparation for analysis and testing strategies against historical data.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Retrieve historical prices for Chinese, US, and Hong Kong stocks
  • Collect Chinese GDP and consumer price data
  • Check futures quotes and foreign exchange rates
HKUDS/Vibe-Trading3.6만2026년 10월 21일 업데이트

alpha-zoo

무료

Explore bundled libraries of investment factors, signals used to compare securities, and inspect individual formulas and metadata. Evaluate a factor or an entire library across a chosen universe and period, producing aggregate performance statistics and an HTML report.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Find bundled momentum or reversal factors
  • Inspect a named factor's formula and metadata
  • Compare a factor library across a chosen universe and period
HKUDS/Vibe-Trading3.6만2026년 10월 21일 업데이트

Assess whether a Chinese A-share company may receive ST or *ST risk warnings next financial year. Review financial forecasts, dividends, audit opinions, and regulatory penalties, then report risk severity separately from confidence in the prediction.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Reviewing a Chinese A-share company's future ST risk
  • Assessing escalation risk for an existing ST or *ST stock
  • Checking revenue, equity, and dividend warning signs
HKUDS/Vibe-Trading3.6만2026년 10월 21일 업데이트

Plan portfolio allocations across assets using risk, correlations, return forecasts, and trading costs. Compare five optimization methods, produce settings for config.json, and define rebalancing rules that adjust holdings back toward their target weights.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Comparing allocations across stocks, bonds, and gold
  • Choosing an optimizer based on return forecasts and correlations
  • Preparing portfolio settings for config.json
HKUDS/Vibe-Trading3.6만2026년 10월 21일 업데이트

Diagnose failed or abnormal backtests, which test trading strategies on historical data. Inspect result files, strategy code, and configuration to identify bugs, make targeted repairs, rerun tests, and verify the updated metrics.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Investigating backtest execution errors
  • Finding why a strategy produces no trades
  • Checking delayed trades or low capital usage
HKUDS/Vibe-Trading3.6만2026년 10월 21일 업데이트

HKUDS의 스킬 모두 보기

이 스킬의 문제 신고