Agent skill

Multi-Factor Stock Ranking

by HKUDS in HKUDS/Vibe-Trading

Ranks stocks by standardized factor scores (momentum, reversal, volatility, volume and valuation) and builds an equal-weight TopN portfolio with periodic rebalancing.

MITAuto-check passedBusiness, Finance & HR

Install Multi-Factor Stock Ranking

skills CLI
$ npx skills add HKUDS/Vibe-Trading --skill multi-factor -a claude-code

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

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading multi-factor --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/multi-factor .claude/skills/multi-factor && 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
multi-factor
GitHub stars
35k
Token cost
~1k tokens
SKILL.md length
411 words
Files
3
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Ranks stocks by standardized factor scores (momentum, reversal, volatility, volume and valuation) and builds an equal-weight TopN portfolio with periodic rebalancing.

  • Works in 4 steps: Factor calculation: calculate N factors… → Cross-sectional standardization:… → Composite scoring: sum the factors with… → …
  • Building a TopN stock portfolio from several standardized factors
  • SKILL.md covers Purpose, Signal Logic, Built-In Factors and Parameters, plus 4 more sections
  • Runs Python scripts from its folder; calls pip

What it does

At each date the skill computes several factors for many stocks, standardizes each one across the cross-section with Z-scores, adds them into a composite score with equal or custom weights, and goes long the TopN names at 1/N each. Built-in factors are momentum, reversal, volatility and volume ratio, plus 1/PE, 1/PB and ROE factors when extra_fields exist for A-shares.

Defaults are a 20-day momentum and volatility window, three selected stocks and a rebalance every 20 trading days. The pitfalls list is practical: standardization needs at least three stocks, signals stay unchanged between rebalance dates, factor directions must be aligned before standardization, and weights must be normalized. Two example engines are included, one of them a zoo signal engine, and the code needs pandas and numpy.

When your agent uses it

  • Building a TopN stock portfolio from several standardized factors
  • Combining factors with equal weights or IC-based weights
  • Setting a rebalancing frequency for a cross-sectional strategy
  • Avoiding mistakes in factor direction and standardization

Example prompts

  • “Write a multi-factor signal engine with momentum, volatility and 1/PE, selecting the top 5 stocks.”
  • “Rebalance only every 20 trading days and hold the previous signal in between.”
  • “Why do my Z-scores look meaningless with only two stocks?”
  • “Add an ROE factor from extra_fields to the composite score.”

Requirements

  • Python with pandas and numpy

Workflow steps

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

  1. Factor calculation: calculate N factors for each stock (such as momentum, value, and quality)
  2. Cross-sectional standardization: standardize each factor on the cross-section with Z-score normalization (subtract mean, divide by…
  3. Composite scoring: sum the factors with equal weights (or custom weights) to obtain a composite score
  4. Rank and select: go long the TopN names, with weight = 1/N for each

What it can do on your machine

Read from SKILL.md and the folder at commit 7f6908b. 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

Multi-Factor Stock Ranking loads about 1k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 411 words of instructions outside code blocks.

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

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 7f6908b, republished under its MIT licence (© HKUDS). 411 words, ~1,025 tokens.

Download SKILL.mdSave it as .claude/skills/multi-factor/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
multi-factor
description
Multi-factor cross-sectional stock ranking. Combines factor standardization, equal-weight or IC-weighted scoring, and TopN portfolio construction. Suitable for multi-instrument portfolio strategies.
category
strategy

Multi-Factor Cross-Sectional Stock Ranking

Purpose

On the same time cross-section, compute multiple factor values for many stocks, standardize them, combine them into a composite score, and select the top-ranked stocks to build a portfolio.

Signal Logic

  1. Factor calculation: calculate N factors for each stock (such as momentum, value, and quality)
  2. Cross-sectional standardization: standardize each factor on the cross-section with Z-score normalization (subtract mean, divide by standard deviation)
  3. Composite scoring: sum the factors with equal weights (or custom weights) to obtain a composite score
  4. Rank and select: go long the TopN names, with weight = 1/N for each

Built-In Factors

Factor NameCalculation MethodDirection
momentumReturn over the past N daysPositive (higher is better)
reversalReturn over the past 5 daysNegative (lower is better)
volatilityStandard deviation of returns over the past N daysNegative (lower is better)
volume_ratioToday's volume / N-day average volumePositive

If extra_fields are available (China A-shares), you can also add:

  • pe_factor: 1/PE (the larger, the cheaper)
  • pb_factor: 1/PB
  • roe_factor: ROE (the larger, the better)

Parameters

ParameterDefaultDescription
momentum_window20Momentum lookback window
vol_window20Volatility lookback window
top_n3Number of selected stocks
rebalance_freq20Rebalancing frequency (trading days)

Common Pitfalls

  • Cross-sectional standardization requires at least 3 stocks, otherwise Z-scores are meaningless
  • Keep the previous signal unchanged between rebalance dates (do not rerank every day)
  • Factors have different directions: momentum is positively sorted, volatility is negatively sorted, so directions must be aligned before standardization
  • Portfolio weights must be normalized: each TopN stock gets 1/N, all others get 0
Show full SKILL.md (152 more words)Show less

Dependencies

bash
pip install pandas numpy

Signal Convention

  • 1/N = selected into TopN (equal-weight long), 0 = not selected

Zoo Signal Engine (new in 0.1.8)

When the user wants to compose 1-N alphas drawn from the Alpha Zoo (450+ pre-built factors) into a multi-factor strategy, use ZooSignalEngine.from_zoo(...) from zoo_signal_engine.py instead of the old per-symbol example_signal_engine.py. The new engine operates on wide-panel dict[str, pd.DataFrame] inputs (the same shape the registry's Alpha.compute(panel) contract uses), redistributes weights when any alpha fails or is skipped, and supports long-only (top_n), short-only (bottom_n), and long-short (top_n + bottom_n) signal modes. It also exposes a generate(data_map) adapter so it drops straight into the existing run_backtest pipelines.

python
from src.factors.registry import Registry
from zoo_signal_engine import ZooSignalEngine

registry = Registry()
# Browse candidates with registry.list(theme="momentum") -- see the alpha-zoo skill.
alpha_ids = ["alpha101_001", "alpha101_012", "guotai_191_003"]
engine = ZooSignalEngine.from_zoo(alpha_ids, top_n=10, bottom_n=10, standardize=True)
# Feed into a panel-aware backtest, or via .generate(data_map) into the bundled engines.
signal_panel = engine.compute_signal(panel)  # DataFrame, same shape as panel["close"]

Cross-references:

  • See the alpha-zoo skill for browsing the alpha catalogue, filtering by theme/universe, and inspecting __alpha_meta__ records.
  • example_signal_engine.py is kept for legacy per-symbol workflows that compute factors directly from raw OHLCV; new code should prefer zoo_signal_engine.py so it benefits from the 450+ zoo alphas, registry-level NaN/inf guardrails, and per-alpha skip isolation.

© 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 2 other files in agent/src/skills/multi-factor of HKUDS/Vibe-Trading.

  • SKILL.md
  • example_signal_engine.py
  • zoo_signal_engine.py

Open the folder on GitHubat commit 7f6908b

Compare with similar skills

Multi-Factor Stock Ranking 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.

Multi-Factor Stock Ranking compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Multi-Factor Stock Ranking this skillHKUDS/Vibe-Trading35k—~1kAutomated safety check: PassMIT
Tushare Datazillionare/zillionare3182 repos~2.3kAutomated safety check: PassNone
Quant Blog Writingzillionare/zillionare318—~895Automated safety check: PassNone
Quant Analystmajiayu000/claude-skill-registry6661 repos~964Automated safety check: PassMIT
WorldQuant BRAIN Alpha ResearchQuantML-Research/wq-alpha-research405—~4.9kAutomated safety check: PassNone
Polymarket Tennislivetennisapi/livetennisapi-mcp152—~3kAutomated safety check: PassMIT

Similar skills

  • Tushare Data

    zillionare/zillionare

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

    318 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • Quant Blog Writing

    zillionare/zillionare

    撰写文笔精炼、富有深度的量化交易博文,论点清晰、证据确凿、叙事层次更加丰富。适用于量化交易博文、因子研究、回测复盘、数据源排查、市场微观结构、策略原理、风险控制、职业观察、量化人物故事等选题。文章将聚焦具体角度,提供详实的大纲、证据规划及成稿,力求内容兼具思想深度与诚实性,而非单纯口号式宣传;同时,通过人物经历、引言、贡献及行业背景的融入,让文章更具可读性和吸引力。

    318 GitHub stars~895 tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Quant Analyst

    majiayu000/claude-skill-registry

    Expert in quantitative finance, algorithmic trading, and financial data analysis using Python (Pandas/NumPy), statistical modeling, and machine learning.

    666 GitHub starsUsed in 1 repo~964 tokens
    Data & AnalyticsAuto-check passed
  • WorldQuant BRAIN Alpha Research

    QuantML-Research/wq-alpha-research

    Chinese-language playbook for WorldQuant BRAIN alphas: choose fields, write expressions, backtest, diagnose check failures, tune turnover, submit and build portfolios.

    405 GitHub stars~4.9k tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check passed
  • Polymarket Tennis

    livetennisapi/livetennisapi-mcp

    Build observe-only Polymarket and Kalshi tennis market tooling on the polymarket-tennis Python package (MIT) plus the Live Tennis API free tier.

    152 GitHub stars~3k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Backtesting

    gauss314/skills

    Academic backtesting framework for quantitative research. An agent skill from gauss314/skills.

    245 GitHub stars~2.4k tokensUpdated 3 mo ago
    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

Questions about Multi-Factor Stock Ranking

What does Multi-Factor Stock Ranking do?

Ranks stocks by standardized factor scores (momentum, reversal, volatility, volume and valuation) and builds an equal-weight TopN portfolio with periodic rebalancing. At each date the skill computes several factors for many stocks, standardizes each one across the cross-section with Z-scores, adds them into a composite score with equal or custom weights, and goes long the TopN names at 1/N each. Built-in factors are momentum, reversal, volatility and volume ratio, plus 1/PE, 1/PB and ROE factors when extra_fields exist for A-shares.

When should I use Multi-Factor Stock Ranking?

Multi-Factor Stock Ranking fits situations like: building a TopN stock portfolio from several standardized factors; combining factors with equal weights or IC-based weights; setting a rebalancing frequency for a cross-sectional strategy; avoiding mistakes in factor direction and standardization.

How do I install Multi-Factor Stock Ranking in Claude Code?

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

How do I install Multi-Factor Stock Ranking in Codex?

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

Can I use Multi-Factor Stock Ranking 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 multi-factor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/multi-factor, .gemini/skills/multi-factor, .github/skills/multi-factor and .opencode/skills/multi-factor in your project.

What does Multi-Factor Stock Ranking need to run?

Going by SKILL.md and its folder, Multi-Factor Stock Ranking needs Python for the scripts in its folder and the command-line tools its instructions call (pip). Our summary lists: Python with pandas and numpy.

Does Multi-Factor Stock Ranking 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 Multi-Factor Stock Ranking 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 Multi-Factor Stock Ranking use?

Multi-Factor Stock Ranking 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 Multi-Factor Stock Ranking use?

About 1k tokens (SKILL.md is roughly 4.1k 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 Multi-Factor Stock Ranking?

Skills that share tags, products or a category with Multi-Factor Stock Ranking: Tushare Data (zillionare/zillionare, 318 stars), Quant Blog Writing (zillionare/zillionare, 318 stars), Quant Analyst (majiayu000/claude-skill-registry, 666 stars) and WorldQuant BRAIN Alpha Research (QuantML-Research/wq-alpha-research, 405 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Multi-Factor Stock Ranking?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 34,884 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 6, 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.