Agent skill

Fundamental Factor Screening

by HKUDS in HKUDS/Vibe-Trading

Builds value or growth stock screens from PE, PB, ROE and financial statement fields for backtests, using tushare data for A-shares and yfinance for Hong Kong and US stocks.

MITAuto-check passedBusiness, Finance & HR

Install Fundamental Factor Screening

skills CLI
$ npx skills add HKUDS/Vibe-Trading --skill fundamental-filter -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading fundamental-filter --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/fundamental-filter .claude/skills/fundamental-filter && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fundamental-filter
GitHub stars
35k
Token cost
~1.7k tokens
SKILL.md length
475 words
Files
2
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Builds value or growth stock screens from PE, PB, ROE and financial statement fields for backtests, using tushare data for A-shares and yfinance for Hong Kong and US stocks.

  • Works in 4 steps: PE < pe_max AND PE > 0 (exclude… → PB < pb_max → ROE > roe_min → …
  • Building a value screen on PE, PB and ROE for a backtest
  • SKILL.md covers Purpose, Market Support, Signal Logic and A-Share Usage (tushare), plus 5 more sections
  • Runs Python scripts from its folder; calls pip

What it does

The skill produces long or flat signals from fundamental data. The value filter requires a positive PE below a maximum, PB below a limit and ROE above a minimum, while the optional growth filter checks a reasonable PE_TTM range, a profitability floor and a market cap minimum that drops micro-caps. A table shows which metrics each market supports and how they are fetched.

For A-shares, daily valuation fields such as pe, pb and roe come in through extra_fields in config.json, and statement fields from the income, balance sheet, cash flow and financial indicator tables come in through fundamental_fields. Statement data is merged into daily bars only after its disclosure date, which keeps the test free of look-ahead, with columns prefixed by table name. Hong Kong and US stocks read trailingPE, priceToBook, returnOnEquity and similar fields from yfinance Ticker info. An example_signal_engine.py is included.

When your agent uses it

  • Building a value screen on PE, PB and ROE for a backtest
  • Setting extra_fields or fundamental_fields in config.json for A-shares
  • Screening Hong Kong or US stocks with yfinance fundamentals
  • Adding a financial-quality pre-filter that avoids look-ahead bias

Example prompts

  • “Write a value screen for 000001.SZ, 600036.SH and 000858.SZ using PE, PB and ROE thresholds.”
  • “Configure fundamental_fields so my strategy can read income.total_revenue and fina_indicator.roe.”
  • “Screen these US tickers on trailingPE and returnOnEquity using yfinance.”
  • “Add a growth filter that excludes micro-cap stocks.”

Requirements

  • A tushare data source for A-shares
  • yfinance for Hong Kong and US stocks

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  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)

What it can do on your machine

Read from SKILL.md and the folder at commit b1f6ce7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Fundamental Factor Screening loads about 1.7k tokens when it runs. Until then it costs about 67 tokens; SKILL.md has 475 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~67
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/Vibe-Trading at commit b1f6ce7, republished under its MIT licence (© HKUDS). 475 words, ~1,689 tokens.

Download SKILL.mdSave it as .claude/skills/fundamental-filter/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
fundamental-filter
description
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).
category
flow

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

MarketData SourceMethodSupported Metrics
A-sharestushare daily_basicextra_fields in config.jsonpe, pb, pe_ttm, ps_ttm, dv_ttm, total_mv, circ_mv, roe
A-sharesTushare statementsfundamental_fields in config.jsonincome, balancesheet, cashflow, fina_indicator fields
US stocksyfinance Ticker.infoDirect API calltrailingPE, forwardPE, priceToBook, returnOnEquity, marketCap, dividendYield
HK stocksyfinance Ticker.infoDirect API calltrailingPE, 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
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:

json
{
  "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 fieldSignalEngine column
income.total_revenueincome_total_revenue
income.n_incomeincome_n_income
balancesheet.total_hldr_eqy_exc_min_intbalancesheet_total_hldr_eqy_exc_min_int
fina_indicator.roefina_indicator_roe

Representative financial-quality pre-filter:

python
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:

python
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
python
# HK stocks use the same yfinance interface
hk_tickers = ["0700.HK", "9988.HK", "1810.HK", "2318.HK", "0005.HK"]
results = screen_us_stocks(hk_tickers, criteria)  # Same function works

Parameters

ParameterDefaultDescription
pe_max20.0PE ceiling (exclude overvalued)
pb_max3.0PB ceiling
roe_min8.0ROE floor (%), exclude low-profitability
pe_min0.0PE floor (exclude loss-making stocks)
mcap_min0Market cap floor (for US/HK, in USD)
Show full SKILL.md (193 more words)Show less

Common Pitfalls

  • extra_fields columns may contain NaN (new listings, ST stocks) — must fillna or dropna
  • fundamental_fields columns are prefixed by table and may be NaN before the first statement is published in the backtest window
  • fundamental_fields is daily-only: an announcement date has no time of day, so an intraday interval is rejected rather than silently making a filing visible from the first bar of its own announcement day. "fundamental_subdaily": "next_day" opts in, with day D's filing visible from the first bar of D+1
  • Do not forward-fill statement rows manually before their ann_date / f_ann_date; the runner's merge already enforces point-in-time visibility
  • Negative PE means loss-making — always filter with pe > 0
  • ROE units differ: tushare uses percentage (e.g., 15 = 15%), yfinance uses decimal (e.g., 0.15 = 15%)
  • For portfolio strategies: N stocks passing the screen each get weight 1/N
  • yfinance Ticker.info is a point-in-time snapshot, not historical time-series — cannot directly use for daily rebalancing backtests on US/HK stocks
  • For US/HK daily fundamental backtests, consider using the screening results as a stock universe, then applying technical signals within that universe

Dependencies

bash
pip install pandas numpy yfinance

Signal Convention

  • 1/N = selected for long (N = number of stocks passing the screen), 0 = not selected

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in agent/src/skills/fundamental-filter of HKUDS/Vibe-Trading.

  • SKILL.md
  • example_signal_engine.py

Open the folder on GitHubat commit b1f6ce7

Compare with similar skills

Fundamental Factor Screening next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Fundamental Factor Screening compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fundamental Factor Screening this skillHKUDS/Vibe-Trading35k—~1.7kAutomated safety check: PassMIT
US Market Data ToolkitGeeksfino/finskills282—~1.2kAutomated safety check: PassApache-2.0
Value Stock Screenerokikusan-public/stock_skills135—~2.4kAutomated safety check: PassNone
Yfinance Datahimself65/finance-skills3.4k—~1.3kAutomated safety check: PassMIT
Fin Yfinance Datacriptogus/agent-evolve-network288—~806Automated safety check: PassMIT
Stock Deep Analysis Workflowwbh604/UZI-Skill7.1k—~9.1kAutomated safety check: NotesMIT

Similar skills

  • US Market Data Toolkit

    Geeksfino/finskills

    Free Python scripts that fetch US stock data, SEC filings, insider trades and macro indicators, and run financial score calculators and portfolio analytics.

    282 GitHub stars~1.2k tokensUpdated 7 mo ago
    Business, Finance & HRAuto-check passed
  • Value Stock Screener

    okikusan-public/stock_skills

    Screens for undervalued stocks across about 60 regions with yfinance's EquityQuery, using ratios such as PER, PBR, dividend yield and ROE, with optional theme filters.

    135 GitHub stars~2.4k tokensUpdated 5 mo ago
    Business, Finance & HRAuto-check passed
  • Yfinance Data

    himself65/finance-skills

    Fetch financial and market data with the yfinance Python library (Yahoo Finance).

    3.4k GitHub stars~1.3k tokensUpdated 5 days ago
    Business, Finance & HRAuto-check passed
  • Fin Yfinance Data

    criptogus/agent-evolve-network

    Fetch market and fundamental data via the yfinance Python library — quotes, OHLC history, financial statements, holders, dividends, options, and more.

    288 GitHub stars~806 tokensUpdated 2 days ago
    Business, Finance & HRAuto-check passed
  • Runs a staged deep analysis of a single stock on China A-share, Hong Kong and US markets, ending in an HTML report with valuation models and investor-panel scores.

    7.1k GitHub stars~9.1k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check: notes
  • Tushare Data

    zillionare/zillionare

    面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。

    321 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed

More from HKUDS/Vibe-Trading

All 89 skills in this repo
  • Eastmoney Market Data

    HKUDS/Vibe-Trading

    Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.

    35k GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • OKX Market Data

    HKUDS/Vibe-Trading

    Retrieves public OKX cryptocurrency market data such as spot prices, candlesticks, funding rates and open interest through the OKX V5 REST API, with no authentication.

    35k GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • SEC EDGAR Filings Fetcher

    HKUDS/Vibe-Trading

    Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.

    35k GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • A-Share ST Risk Screener

    HKUDS/Vibe-Trading

    Predicts whether a mainland China A-share company risks an ST or *ST warning after its next annual report, using financial thresholds and Sina penalty records.

    35k GitHub stars~4.9k tokensUpdated yesterday
    Auto-check passed
  • Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.

    35k GitHub stars~2.7k tokensUpdated yesterday
    Auto-check passed
  • Plans and drafts an eight-part, roughly 120k-word investigative series on one company, built around a strict fact-check pass rather than fast drafting.

    35k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Fundamental Factor Screening

What does Fundamental Factor Screening do?

Builds value or growth stock screens from PE, PB, ROE and financial statement fields for backtests, using tushare data for A-shares and yfinance for Hong Kong and US stocks. The skill produces long or flat signals from fundamental data. The value filter requires a positive PE below a maximum, PB below a limit and ROE above a minimum, while the optional growth filter checks a reasonable PE_TTM range, a profitability floor and a market cap minimum that drops micro-caps.

When should I use Fundamental Factor Screening?

Fundamental Factor Screening fits situations like: building a value screen on PE, PB and ROE for a backtest; setting extra_fields or fundamental_fields in config.json for A-shares; screening Hong Kong or US stocks with yfinance fundamentals; adding a financial-quality pre-filter that avoids look-ahead bias.

How do I install Fundamental Factor Screening in Claude Code?

Run `npx skills add HKUDS/Vibe-Trading --skill fundamental-filter -a claude-code`. Or copy the skill folder (agent/src/skills/fundamental-filter in HKUDS/Vibe-Trading) into .claude/skills/fundamental-filter in your project. Claude Code loads it when a task matches its description.

How do I install Fundamental Factor Screening in Codex?

Run `npx skills add HKUDS/Vibe-Trading --skill fundamental-filter -a codex`. Or copy the skill folder (agent/src/skills/fundamental-filter in HKUDS/Vibe-Trading) into .agents/skills/fundamental-filter in your project. Codex loads it when a task matches its description.

Can I use Fundamental Factor Screening in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/Vibe-Trading --skill fundamental-filter -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fundamental-filter, .gemini/skills/fundamental-filter, .github/skills/fundamental-filter and .opencode/skills/fundamental-filter in your project.

What does Fundamental Factor Screening need to run?

Going by SKILL.md and its folder, Fundamental Factor Screening needs Python for the scripts in its folder and the command-line tools its instructions call (pip). Our summary lists: A tushare data source for A-shares; yfinance for Hong Kong and US stocks.

Does Fundamental Factor Screening access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Fundamental Factor Screening safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Fundamental Factor Screening use?

Fundamental Factor Screening is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Fundamental Factor Screening use?

About 1.7k tokens (SKILL.md is roughly 6.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Fundamental Factor Screening?

Skills that share tags, products or a category with Fundamental Factor Screening: US Market Data Toolkit (Geeksfino/finskills, 282 stars), Value Stock Screener (okikusan-public/stock_skills, 135 stars), Yfinance Data (himself65/finance-skills, 3.4k stars) and Fin Yfinance Data (criptogus/agent-evolve-network, 288 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fundamental Factor Screening?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,097 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 9, 2026.

Source: HKUDS/Vibe-Trading on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.