CtrlK
BlogDocsLog inGet started
Tessl Logo

multi-factor

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.

60

Quality

70%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./a_全网优秀资源/10_大模型/07_skill包/vibe_trading_skills/multi-factor/SKILL.md
SKILL.md
Quality
Evals
Security

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

Dependencies

pip install pandas numpy

Signal Convention

  • 1/N = selected into TopN (equal-weight long), 0 = not selected
Repository
charliedream1/ai_quant_trade
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.