Guide users to create multi-factor stock selection strategies and generate independent YAML configuration files
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install multi-factor-strategy或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install multi-factor-strategy⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/multi-factor-strategy/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: multi-factor-strategy description: Guide users to create multi-factor stock selection strategies and generate independent YAML configuration files --- {"homepage":"https://gitcode.com/datavoid/quantcli","user-invocable":true}
Guide you to create multi-factor stock selection strategies and generate independent YAML configuration files.
# Install from PyPI (recommended)
pip install quantcli
# Or install from source
git clone https://gitcode.com/datavoid/quantcli.git
cd quantcli
pip install -e .
Verify installation:
quantcli --help
A complete multi-factor stock selection strategy YAML example:
name: Value-Growth Hybrid Strategy
version: 1.0.0
description: ROE + Momentum factor stock selection
screening:
fundamental_conditions: # Stage 1: Financial condition screening
- "roe > 0.10" # ROE > 10%
- "pe_ttm < 30" # P/E < 30
- "pe_ttm > 0" # Exclude losses
daily_conditions: # Stage 2: Price condition screening
- "close > ma10" # Above 10-day MA
limit: 100 # Keep at most 100 stocks
# Factor configuration (supports two methods, factors at top level)
factors:
# Method 1: Inline factor definition
- name: ma10_deviation
expr: "(close - ma(close, 10)) / ma(close, 10)"
direction: negative
description: "10-day MA deviation"
# Method 2: External reference (reference factor files in factors/ directory, include .yaml suffix)
- factors/alpha_001.yaml
- factors/alpha_008.yaml
ranking:
weights: # Weight fusion
ma10_deviation: 0.20 # Inline factor
factors/alpha_001.yaml: 0.40 # External reference factor
factors/alpha_008.yaml: 0.40
normalize: zscore # Normalization method
output:
limit: 30 # Output top 30 stocks
columns: [symbol, name, score, roe, pe_ttm, close, ma10_deviation]
Factor configuration supports two methods (can be mixed):
| Method | Type | Example | Description | |--------|------|---------|-------------| | Inline | dict | {name: xxx, expr: "..."} | Define expression directly in YAML | | External | str | factors/alpha_001.yaml | Load factor file from factors/ directory |
Example: Mixed usage
factors:
# Inline: Custom factor
- name: custom_momentum
expr: "close / delay(close, 20) - 1"
direction: positive
# External: Alpha101 factor library (include .yaml suffix)
- factors/alpha_001.yaml
- factors/alpha_005.yaml
- factors/alpha_009.yaml
ranking:
weights:
custom_momentum: 0.3
factors/alpha_001.yaml: 0.3
factors/alpha_005.yaml: 0.2
factors/alpha_009.yaml: 0.2
Run strategy:
quantcli filter run -f your_strategy.yaml
/multi-factor-strategy
| Function | Usage | Description | |----------|-------|-------------| | delay | delay(x, n) | Lag n periods | | ma | ma(x, n) | Simple moving average | | ema | ema(x, n) | Exponential moving average | | rolling_sum | rolling_sum(x, n) | Rolling sum | | rolling_std | rolling_std(x, n) | Rolling standard deviation |
| Function | Usage | Description | |----------|-------|-------------| | rsi | rsi(x, n=14) | Relative strength index | | correlation | correlation(x, y, n) | Correlation coefficient | | cross_up | cross_up(a, b) | Golden cross (a crosses above b) | | cross_down | cross_down(a, b) | Death cross (a crosses below b) |
| Function | Usage | Description | |----------|-------|-------------| | rank | rank(x) | Cross-sectional ranking (0-1) | | zscore | zscore(x) | Standardization | | sign | sign(x) | Sign function | | clamp | clamp(x, min, max) | Clipping function |
| Function | Usage | Description | |----------|-------|-------------| | where | where(cond, t, f) | Conditional selection | | if | if(cond, t, f) | Conditional selection (alias) |
| Field | Description | |-------|-------------| | open, high, low, close | OHLC prices | | volume | Trading volume | | pe, pb | P/E ratio, P/B ratio | | roe | Return on equity | | netprofitmargin | Net profit margin |
I will first understand your strategy needs:
Based on your strategy goals, recommend suitable factor combinations:
Common Fundamental Factors: | Factor | Expression | Direction | Description | |--------|------------|-----------|-------------| | roe | roe | positive | Return on equity | | pe | pe | negative | Lower P/E is better | | pb | pb | negative | Price-to-book ratio | | netprofitmargin | netprofitmargin | positive | Net profit margin | | revenue_growth | revenue_yoy | positive | Revenue growth rate |
Common Technical Factors: | Factor | Expression | Direction | Description | |--------|------------|-----------|-------------| | momentum | (close/delay(close,20))-1 | positive | N-day momentum | | ma_deviation | (close-ma(close,10))/ma(close,10) | negative | MA deviation | | ma_slope | (ma(close,10)-delay(ma(close,10),5))/delay(ma(close,10),5) | positive | MA slope | | volume_ratio | volume/ma(volume,5) | negative | Volume ratio |
Alpha101 Built-in Factors (can reference {baseDir}/alpha101/alpha_XXX):
QuantCLI includes 40 WorldQuant Alpha101 factors that can be directly referenced:
| Factor | Category | Description | |--------|----------|-------------| | alpha101/alpha_001 | Reversal | 20-day new high then decline | | alpha101/alpha_002 | Reversal | Down volume bottom | | alpha101/alpha_003 | Volatility | Low volatility stability | | alpha101/alpha_004 | Capital Flow | Net capital inflow | | alpha101/alpha_005 | Trend | Uptrend | | alpha101/alpha_008 | Capital Flow | Capital inflow | | alpha101/alpha_009 | Momentum | Long-term momentum | | alpha101/alpha_010 | Reversal | MA deviation reversal | | alpha101/alpha_011 ~ alpha_020 | Extended | Volatility, momentum, price-volume factors | | alpha101/alpha_021 ~ alpha_030 | Extended | Price-volume, trend, strength factors | | alpha101/alpha_031 ~ alpha_040 | Extended | Position, volatility, capital factors |
View all built-in factors:
quantcli factors list
Usage Example:
factors:
- alpha101/alpha_001 # Reversal factor
- alpha101/alpha_008 # Capital inflow
- alpha101/alpha_029 # 5-day momentum
ranking:
weights:
alpha101/alpha_001: 0.4
alpha101/alpha_008: 0.3
alpha101/alpha_029: 0.3
Screening Conditions Example:
screening:
conditions:
- "roe > 0.10" # ROE > 10%
- "netprofitmargin > 0.05" # Net profit margin > 5%
Allocate weights based on factor importance, 0 means only for screening, not scoring:
ranking:
weights:
# Fundamental factors
roe: 0.30
pe: 0.20
# Technical factors
ma_deviation: 0.30
momentum: 0.20
normalize: zscore
I will generate a complete strategy YAML file for you:
name: Your Strategy Name
version: 1.0.0
description: Strategy description
# Stage 1: Fundamental screening
screening:
conditions:
- "roe > 0.10"
- "pe < 30"
limit: 200
# Stage 2: Technical ranking
ranking:
weights:
roe: 0.30
pe: 0.20
ma_deviation: 0.30
momentum: 0.20
normalize: zscore
output:
columns: [symbol, score, rank, roe, pe, momentum]
limit: 30
...
安装 multi-factor-strategy 后,可以对 AI 说这些话来触发它
Help me get started with multi-factor-strategy
Explains what multi-factor-strategy does, walks through the setup, and runs a quick demo based on your current project
Use multi-factor-strategy to guide users to create multi-factor stock selection strategies and g...
Invokes multi-factor-strategy with the right parameters and returns the result directly in the conversation
What can I do with multi-factor-strategy in my product manager workflow?
Lists the top use cases for multi-factor-strategy, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/multi-factor-strategy/ 目录(个人级,所有项目可用),或 .claude/skills/multi-factor-strategy/(项目级)。重启 AI 客户端后,用 /multi-factor-strategy 主动调用,或让 AI 根据上下文自动发现并使用。
multi-factor-strategy 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
multi-factor-strategy 可免费安装使用。请查阅仓库了解许可证信息。
Guide users to create multi-factor stock selection strategies and generate independent YAML configuration files
multi-factor-strategy 属于「Product Manager」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my product manager tasks using multi-factor-strategy
Identifies repetitive steps in your workflow and sets up multi-factor-strategy to handle them automatically