multi-factor
하는 일
이 스킬은 여러 기준으로 종목 그룹을 점수화하고 순위가 높은 종목을 고릅니다. 많은 종목으로 한꺼번에 포트폴리오를 만드는 투자자를 위한 스킬입니다.
사용하는 경우
- ✓여러 기준을 함께 써서 한 그룹에서 상위 종목을 고르고 싶을 때.
- ✓모멘텀, 변동성, 거래량을 한꺼번에 비교하고 싶을 때.
- ✓상위 종목들로 동일 비중 포트폴리오를 만들고 싶은 경우.
스킬 링크
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/multi-factor/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 50개 종목을 모멘텀과 변동성으로 순위를 매기고, 상위 10개를 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 각 종목을 팩터별로 점수화하고, 공정하게 비교할 수 있도록 점수를 표준화한 뒤 합산합니다. 점수가 높은 종목들이 동일 비중으로 포트폴리오에 들어갑니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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.
자주 묻는 질문
팩터란 무엇인가요?
최근 수익률이나 가격 변동 폭처럼 종목에서 측정할 수 있는 특성입니다.
가중치를 바꿀 수 있나요?
네. 스킬은 동일 가중이나 팩터별 사용자 지정 가중을 허용합니다.
기본으로 포함된 팩터는 무엇인가요?
모멘텀, 반전, 변동성, 거래량 비율을 포함하며, 데이터가 있으면 가치 팩터도 추가합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 37k
- 순위
- #7534
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
vibe-trading
37k에이전트에게 백테스트, 팩터 분석, 옵션 가격 결정, 여러 시장의 시장 데이터를 포함하는 완전한 금융 연구 도구 모음을 제공합니다.
adr-hshare
37k에이전트에게 미국 ADR과 홍콩 주식처럼 여러 시장에 상장된 중국 기업의 가격을 비교하는 방법을 보여 줍니다.
akshare
37k에이전트가 API 키 없이 중국과 해외 주식, 선물, 외환, 경제 지표의 무료 시장 데이터를 가져오도록 돕습니다.
alpha-zoo
37k에이전트가 만들어진 주식 팩터 라이브러리를 둘러보고, 선택한 시장에서 팩터 묶음이 수익률을 얼마나 잘 예측하는지 시험하도록 돕습니다.
비슷한 스킬
gitcrawl
394k에이전트가 저장된 GitHub 이슈와 풀 리퀘스트 보관본을 검색하고, 중복 항목을 묶고, GitHub에서 현재 상태를 확인하도록 돕습니다.
slacrawl
394k에이전트가 로컬 Slack 보관본에서 메시지를 검색하고 개수를 세며, 보관본이 얼마나 최신인지 확인하고 필요할 때 새로 고치도록 돕습니다.
goplaces
394k에이전트가 Google Places로 장소를 검색하고, 세부 정보와 리뷰를 가져오고, 장소 이름을 확인하며, 스크립트용 JSON을 출력하도록 돕습니다.