multi-factor-strategy

1
0
Source

Guide users to create multi-factor stock selection strategies and generate independent YAML configuration files

Install

mkdir -p .claude/skills/multi-factor-strategy && curl -L -o skill.zip "https://mcp.directory/api/skills/download/6125" && unzip -o skill.zip -d .claude/skills/multi-factor-strategy && rm skill.zip

Installs to .claude/skills/multi-factor-strategy

About this skill

{"homepage":"https://gitcode.com/datavoid/quantcli","user-invocable":true}

Multi-Factor Strategy Assistant

Guide you to create multi-factor stock selection strategies and generate independent YAML configuration files.

Install quantcli

# 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

Quick Start

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 Methods

Factor configuration supports two methods (can be mixed):

MethodTypeExampleDescription
Inlinedict{name: xxx, expr: "..."}Define expression directly in YAML
Externalstrfactors/alpha_001.yamlLoad 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

Invocation

/multi-factor-strategy

Available Expression Functions

Data Processing Functions

FunctionUsageDescription
delaydelay(x, n)Lag n periods
mama(x, n)Simple moving average
emaema(x, n)Exponential moving average
rolling_sumrolling_sum(x, n)Rolling sum
rolling_stdrolling_std(x, n)Rolling standard deviation

Technical Indicator Functions

FunctionUsageDescription
rsirsi(x, n=14)Relative strength index
correlationcorrelation(x, y, n)Correlation coefficient
cross_upcross_up(a, b)Golden cross (a crosses above b)
cross_downcross_down(a, b)Death cross (a crosses below b)

Ranking & Normalization Functions

FunctionUsageDescription
rankrank(x)Cross-sectional ranking (0-1)
zscorezscore(x)Standardization
signsign(x)Sign function
clampclamp(x, min, max)Clipping function

Conditional Functions

FunctionUsageDescription
wherewhere(cond, t, f)Conditional selection
ifif(cond, t, f)Conditional selection (alias)

Base Fields

FieldDescription
open, high, low, closeOHLC prices
volumeTrading volume
pe, pbP/E ratio, P/B ratio
roeReturn on equity
netprofitmarginNet profit margin

Guided Workflow

Step 1: Strategy Goal定位

I will first understand your strategy needs:

  • Strategy Type: Value, Growth, Momentum, Volatility, Hybrid
  • Selection Count: Concentrated(10-30), Medium(50-100), Diversified(200+)
  • Holding Period: Intraday, Short-term(week), Medium-term(month), Long-term(quarter)

Step 2: Factor Selection

Based on your strategy goals, recommend suitable factor combinations:

Common Fundamental Factors:

FactorExpressionDirectionDescription
roeroepositiveReturn on equity
pepenegativeLower P/E is better
pbpbnegativePrice-to-book ratio
netprofitmarginnetprofitmarginpositiveNet profit margin
revenue_growthrevenue_yoypositiveRevenue growth rate

Common Technical Factors:

FactorExpressionDirectionDescription
momentum(close/delay(close,20))-1positiveN-day momentum
ma_deviation(close-ma(close,10))/ma(close,10)negativeMA deviation
ma_slope(ma(close,10)-delay(ma(close,10),5))/delay(ma(close,10),5)positiveMA slope
volume_ratiovolume/ma(volume,5)negativeVolume ratio

Alpha101 Built-in Factors (can reference {baseDir}/alpha101/alpha_XXX):

QuantCLI includes 40 WorldQuant Alpha101 factors that can be directly referenced:

FactorCategoryDescription
alpha101/alpha_001Reversal20-day new high then decline
alpha101/alpha_002ReversalDown volume bottom
alpha101/alpha_003VolatilityLow volatility stability
alpha101/alpha_004Capital FlowNet capital inflow
alpha101/alpha_005TrendUptrend
alpha101/alpha_008Capital FlowCapital inflow
alpha101/alpha_009MomentumLong-term momentum
alpha101/alpha_010ReversalMA deviation reversal
alpha101/alpha_011 ~ alpha_020ExtendedVolatility, momentum, price-volume factors
alpha101/alpha_021 ~ alpha_030ExtendedPrice-volume, trend, strength factors
alpha101/alpha_031 ~ alpha_040ExtendedPosition, 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%

Step 3: Weight Configuration

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

Step 4: Generate Strategy File

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

Step 5: Run & Evaluate

Run strategy:

quantcli filter run -f your_strategy.yaml --top 30

Evaluation points:

  1. Selected stock count: Check if screening conditions are reasonable
  2. Factor distribution: Distribution of factor scores
  3. Industry diversification: Avoid over-concentration

FAQ

Q: How to allocate factor weights? A: Core factors 0.3-0.4, auxiliary factors 0.1-0.2, ensure weights sum close to 1

Q: Screening conditions too strict resulting in empty results? A: Gradually relax conditions, first see how many stocks meet each condition

Q: What expression syntax is supported? A: Supports 40+ built-in functions: ma(), ema(), delay(), rolling_sum(), rsi(), rank(), zscore(), etc.

seedream-image-gen

openclaw

Generate images via Seedream API (doubao-seedream models). Synchronous generation.

2359

ffmpeg-cli

openclaw

Comprehensive video/audio processing with FFmpeg. Use for: (1) Video transcoding and format conversion, (2) Cutting and merging clips, (3) Audio extraction and manipulation, (4) Thumbnail and GIF generation, (5) Resolution scaling and quality adjustment, (6) Adding subtitles or watermarks, (7) Speed adjustment (slow/fast motion), (8) Color correction and filters.

6723

context-optimizer

openclaw

Advanced context management with auto-compaction and dynamic context optimization for DeepSeek's 64k context window. Features intelligent compaction (merging, summarizing, extracting), query-aware relevance scoring, and hierarchical memory system with context archive. Logs optimization events to chat.

3722

a-stock-analysis

openclaw

A股实时行情与分时量能分析。获取沪深股票实时价格、涨跌、成交量,分析分时量能分布(早盘/尾盘放量)、主力动向(抢筹/出货信号)、涨停封单。支持持仓管理和盈亏分析。Use when: (1) 查询A股实时行情, (2) 分析主力资金动向, (3) 查看分时成交量分布, (4) 管理股票持仓, (5) 分析持仓盈亏。

9121

himalaya

openclaw

CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).

7921

garmin-connect

openclaw

Syncs daily health and fitness data from Garmin Connect into markdown files. Provides sleep, activity, heart rate, stress, body battery, HRV, SpO2, and weight data.

7321

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318399

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

340397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

452339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.