multi-factor
Skill này làm gì
Skill này chấm điểm một nhóm cổ phiếu theo nhiều tiêu chí và chọn những mã có thứ hạng cao nhất. Skill dành cho nhà đầu tư xây dựng danh mục từ nhiều cổ phiếu cùng lúc.
Khi nào nên dùng
- ✓Khi bạn muốn chọn các cổ phiếu hàng đầu trong một nhóm bằng nhiều tiêu chí cùng lúc.
- ✓Khi bạn muốn so sánh cổ phiếu theo động lượng, biến động và khối lượng cùng lúc.
- ✓Khi bạn muốn xây dựng danh mục có trọng số đều cho các mã xếp hạng cao nhất.
Liên kết skill
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/multi-factor/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xếp hạng 50 cổ phiếu này theo động lượng và biến động, rồi cho tôi xem 10 mã đứng đầu.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill chấm điểm từng cổ phiếu theo từng yếu tố, chuẩn hóa điểm để so sánh công bằng, rồi cộng lại. Các cổ phiếu có điểm cao nhất được đưa vào danh mục với trọng số bằng nhau.
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.
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
- Factor calculation: calculate N factors for each stock (such as momentum, value, and quality)
- Cross-sectional standardization: standardize each factor on the cross-section with Z-score normalization (subtract mean, divide by standard deviation)
- Composite scoring: sum the factors with equal weights (or custom weights) to obtain a composite score
- Rank and select: go long the TopN names, with weight = 1/N for each
Built-In Factors
| Factor Name | Calculation Method | Direction |
|---|---|---|
| momentum | Return over the past N days | Positive (higher is better) |
| reversal | Return over the past 5 days | Negative (lower is better) |
| volatility | Standard deviation of returns over the past N days | Negative (lower is better) |
| volume_ratio | Today's volume / N-day average volume | Positive |
If extra_fields are available (China A-shares), you can also add:
pe_factor: 1/PE (the larger, the cheaper)pb_factor: 1/PBroe_factor: ROE (the larger, the better)
Parameters
| Parameter | Default | Description |
|---|---|---|
| momentum_window | 20 | Momentum lookback window |
| vol_window | 20 | Volatility lookback window |
| top_n | 3 | Number of selected stocks |
| rebalance_freq | 20 | Rebalancing 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
Dependencies
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.
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-zooskill for browsing the alpha catalogue, filtering bytheme/universe, and inspecting__alpha_meta__records. example_signal_engine.pyis kept for legacy per-symbol workflows that compute factors directly from raw OHLCV; new code should preferzoo_signal_engine.pyso it benefits from the 450+ zoo alphas, registry-level NaN/inf guardrails, and per-alpha skip isolation.
Câu hỏi thường gặp
Yếu tố là gì?
Yếu tố là một đặc điểm đo được của cổ phiếu, như lợi nhuận gần đây hoặc mức độ dao động giá của nó.
Tôi có thể thay đổi trọng số không?
Có. Skill cho phép trọng số bằng nhau hoặc trọng số tùy chỉnh cho từng yếu tố.
Skill có sẵn những yếu tố nào?
Nó có động lượng, đảo chiều, biến động và tỷ lệ khối lượng, và thêm các yếu tố giá trị khi có dữ liệu.
Chi tiết
Mô tả gốc của tác giả
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.
repo: HKUDS/Vibe-Trading
Độ phổ biến
- Sao GitHub
- 37k
- Vị trí xếp hạng
- #7534
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
vibe-trading
37kCho agent của bạn bộ công cụ nghiên cứu tài chính đầy đủ: backtest, phân tích nhân tố, định giá quyền chọn và dữ liệu thị trường nhiều nước.
adr-hshare
37kChỉ cho agent của bạn cách so sánh giá của một công ty Trung Quốc được niêm yết ở nhiều thị trường, như ADR ở Mỹ và cổ phiếu ở Hồng Kông.
akshare
37kCho agent của bạn lấy dữ liệu thị trường miễn phí: cổ phiếu Trung Quốc và toàn cầu, tương lai, ngoại hối, chỉ số kinh tế, không cần API key.
alpha-zoo
37kCho agent của bạn duyệt thư viện nhân tố cổ phiếu dựng sẵn và kiểm tra cả một nhóm nhân tố dự đoán lợi nhuận tốt đến đâu trên thị trường đã chọn.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.