본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트37k · #7520

fundamental-filter

하는 일

이 스킬은 주가수익비율, 주가순자산비율, 자기자본이익률 같은 재무 지표로 종목을 거릅니다. 가치 또는 성장 기준을 만들고 시험하려는 투자자를 위한 스킬입니다.

사용하는 경우

  • ✓PER이나 PBR 같은 지표로 저평가 가치 종목을 고르고 싶을 때.
  • ✓아주 작은 기업이나 적자 기업을 제외하는 성장 스크린을 원할 때.
  • ✓재무 스크린을 백테스트 전략으로 시험하고 싶은 경우.

스킬 링크

https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/fundamental-filter/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/fundamental-filter/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“PER과 PBR이 낮고 ROE가 적당한 중국 A주 가치 스크린을 만들고 백테스트해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 각 시장의 데이터 출처에서 재무 데이터를 가져오고, 필터 조건을 적용해 날짜별로 종목을 보유 또는 미보유로 표시합니다. 그다음 각 시장에 맞는 데이터 출처를 써서 백테스트를 실행합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Fundamental Factor Screening

Purpose

Filter stocks using fundamental financial data (PE/PB/ROE, etc.) to build value or growth screen signals for backtesting. Supports multiple markets with different data sources.

Market Support

Market Data Source Method Supported Metrics
A-shares tushare daily_basic extra_fields in config.json pe, pb, pe_ttm, ps_ttm, dv_ttm, total_mv, circ_mv, roe
A-shares Tushare statements fundamental_fields in config.json income, balancesheet, cashflow, fina_indicator fields
US stocks yfinance Ticker.info Direct API call trailingPE, forwardPE, priceToBook, returnOnEquity, marketCap, dividendYield
HK stocks yfinance Ticker.info Direct API call trailingPE, priceToBook, returnOnEquity, marketCap

Signal Logic

Value Filter (Default)

  1. PE < pe_max AND PE > 0 (exclude loss-making stocks)
  2. PB < pb_max
  3. ROE > roe_min
  4. All conditions met → long (1), otherwise → flat (0)

Growth Filter (Optional)

  1. PE_TTM within reasonable range (0 < PE_TTM < pe_ttm_max)
  2. ROE > roe_min (profitability floor)
  3. Market cap > mv_min (exclude micro-caps)

A-Share Usage (tushare)

config.json

{
  "source": "tushare",
  "codes": ["000001.SZ", "600036.SH", "000858.SZ"],
  "start_date": "2023-01-01",
  "end_date": "2024-12-31",
  "extra_fields": ["pe", "pb", "pe_ttm", "roe", "total_mv"],
  "initial_cash": 1000000,
  "commission": 0.001
}

The extra_fields columns are automatically merged into the daily DataFrame by the DataLoader.

A-Share Statement Pre-Filter

Use fundamental_fields when the strategy needs PIT-safe financial statement data instead of daily valuation fields:

{
  "source": "tushare",
  "codes": ["000001.SZ", "600036.SH", "000858.SZ"],
  "start_date": "2023-01-01",
  "end_date": "2024-12-31",
  "fundamental_fields": {
    "income": ["total_revenue", "n_income"],
    "balancesheet": ["total_hldr_eqy_exc_min_int"],
    "fina_indicator": ["roe", "debt_to_assets"]
  },
  "initial_cash": 1000000,
  "commission": 0.001
}

The backtest runner queries the configured tables through TushareFundamentalProvider and merges each published statement snapshot into daily bars only after its announcement/disclosure date. Statement columns are prefixed by table name:

Requested field SignalEngine column
income.total_revenue income_total_revenue
income.n_income income_n_income
balancesheet.total_hldr_eqy_exc_min_int balancesheet_total_hldr_eqy_exc_min_int
fina_indicator.roe fina_indicator_roe

Representative financial-quality pre-filter:

revenue = row.get("income_total_revenue")
profit = row.get("income_n_income")
net_assets = row.get("balancesheet_total_hldr_eqy_exc_min_int")
roe = row.get("fina_indicator_roe")

passes = (
    revenue is not None and revenue > 0
    and profit is not None and profit > 0
    and net_assets is not None and net_assets > 0
    and roe is not None and roe >= 8.0
)

HK/US Stock Usage (yfinance)

For HK/US stocks, fundamental data is not available as daily time-series via the backtest loader. Instead, use yfinance Ticker info for point-in-time screening:

import yfinance as yf

def screen_us_stocks(tickers, criteria):
    """Screen US/HK stocks by fundamental criteria."""
    passed = []
    for symbol in tickers:
        info = yf.Ticker(symbol).info
        pe = info.get("trailingPE")
        pb = info.get("priceToBook")
        roe = info.get("returnOnEquity")  # Decimal (e.g., 0.25 = 25%)
        mcap = info.get("marketCap")

        if pe is None or pb is None or roe is None:
            continue  # Skip stocks with missing data

        if (0 < pe < criteria["pe_max"]
            and pb < criteria["pb_max"]
            and roe > criteria["roe_min"]
            and (mcap or 0) > criteria.get("mcap_min", 0)):
            passed.append({
                "symbol": symbol,
                "pe": pe,
                "pb": pb,
                "roe": round(roe * 100, 1),  # Convert to percentage
                "mcap": mcap,
            })

    return passed

# Example: screen S&P 500 components
criteria = {"pe_max": 20, "pb_max": 3.0, "roe_min": 0.08, "mcap_min": 10_000_000_000}
results = screen_us_stocks(["AAPL", "MSFT", "JNJ", "JPM", "XOM"], criteria)

HK Stock Screening

# HK stocks use 
자주 묻는 질문

적자 기업은 제외되나요?

가치 필터에서는 그렇습니다. PER이 양수여야 하므로 적자 기업은 선택되지 않습니다.

어떤 시장을 지원하나요?

중국 A주, 미국 주식, 홍콩 주식을 지원하며, 시장마다 데이터 출처가 따로 있습니다.

기준값은 어디에서 오나요?

설정 파일에서 직접 정하며, 스킬은 이를 조건으로 적용합니다.

상세 정보

작성자의 원본 설명

Fundamental factor screening — filter stocks by PE/PB/ROE, financial statement fields, and other metrics for value or growth selection. Supports A-shares (via tushare extra_fields or fundamental_fields) and HK/US stocks (via yfinance Ticker info).

repo: HKUDS/Vibe-Trading

인기도

GitHub 스타
37k
순위
#7520
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬