Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính37k · #7520

fundamental-filter

Skill này làm gì

Skill này lọc cổ phiếu theo các chỉ số tài chính như giá trên lợi nhuận, giá trên sổ sách và lợi nhuận trên vốn chủ sở hữu. Skill dành cho nhà đầu tư muốn xây dựng bộ lọc giá trị hoặc tăng trưởng và kiểm tra chúng.

Khi nào nên dùng

  • ✓Khi bạn muốn sàng lọc cổ phiếu theo giá trị bằng các chỉ số như PE và PB.
  • ✓Khi bạn muốn bộ lọc tăng trưởng loại bỏ các công ty rất nhỏ hoặc chưa có lãi.
  • ✓Khi bạn muốn kiểm tra một bộ lọc cơ bản như một chiến lược backtest.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/fundamental-filter/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Xây dựng bộ lọc giá trị cho cổ phiếu A với PE và PB thấp và ROE khá, rồi backtest nó.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent thu thập dữ liệu cơ bản cho từng thị trường từ nguồn của nó, áp dụng các điều kiện lọc và đánh dấu từng cổ phiếu là được nắm giữ hay không tại mỗi ngày. Sau đó nó chạy backtest với các lựa chọn này, dùng nguồn dữ liệu phù hợp với từng thị trường.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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 
Câu hỏi thường gặp

Các cổ phiếu thua lỗ có bị loại không?

Trong bộ lọc giá trị thì có. Cần PE dương, nên các cổ phiếu thua lỗ không được chọn.

Những thị trường nào được hỗ trợ?

Cổ phiếu A, cổ phiếu Mỹ và cổ phiếu Hồng Kông, mỗi thị trường có nguồn dữ liệu riêng.

Các ngưỡng lấy từ đâu?

Bạn đặt chúng trong cấu hình, và skill áp dụng chúng như các điều kiện.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
37k
Vị trí xếp hạng
#7520
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự