xingwudao/open-xquant/build-rule
Claude Code and agent skill by xingwudao/open-xquant
- community
Checking that the SKILL.md file is still in the repository.
Configure and reason about open-xquant trading rules, exits, risk holds, and rebalance limits; use when the user asks for stop loss, take profit, drawdown guards, holding limits, or rule components.
Install
npx vskill@latest install xingwudao/open-xquant/build-ruleSKILL.md
Rule Builder
You help the user add risk and exit logic without overstating current spec support.
Current Execution Model
Rules are Python objects passed to Engine.run(..., rules=[...]) or added by the spec compiler internally. The audited CLI spec path does not support a generic top-level rules: YAML section or oxq backtest run --rules, but it does support a narrow whitelist under portfolio.rules.
In current Engine.step():
- pre-trade rule effects consumed:
RuleResult.weights,RuleResult.hold - post-trade rule effects consumed:
RuleResult.target_positions - declared but not currently consumed by
Engine:RuleResult.constraints
Do not tell the user that a constraints field will affect execution unless you have verified the engine path being used consumes it.
Built-in Rules
Inspect the live registry:
Common built-ins:
ExitRuleStopLossRuleTakeProfitRuleTrailingStopRuleMaxDrawdownRiskDailyLossLimitRiskMaxHoldingsRuleRebalanceFrequencyRuleCalendarRebalanceRuleBlacklistRule
Safe CLI Path
For Crossover specs, compile_run() automatically adds ExitRule using the declared fast and slow columns. For every explicit portfolio.rules item, all required params must be present; do not rely on runtime constructor defaults.
For rebalance throttling by trading-session count, use:
or:
For calendar rebalance, use the execution schedule. The compiler emits CalendarRebalanceRule internally:
Supported audited portfolio.rules entries are:
For portfolio target constraints, use:
portfolio.constraints.min_position_value is parsed but blocked by validation because the audited runtime cannot execute it yet.
Use SDK execution for rules outside the whitelist until the SPEC validator, compiler, runtime, and artifact audit support them.
SDK Pattern
After SDK runs, make sure the user still gets equivalent artifacts or a clear statement that the run is exploratory rather than the standard CLI artifact pipeline.
When A New Rule Is Needed
Load agent/skills/create-component/SKILL.md, then route to agent/skills/create-rule/SKILL.md.
Before creating a rule, confirm:
- pre-trade or post-trade category
- trigger condition
- exact
RuleResultfield to use - whether internal state is required
- how it will be tested with hand-crafted portfolio and bar data
Red Lines
- Do not document unsupported YAML
rules:as working CLI behavior. - Do not claim
constraintschanges execution unless verified in code. - Do not mutate
Portfolioinsideevaluate(). - Do not treat a stop-loss rule as a substitute for research audit.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent/skills/build-rule/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/xingwudao/open-xquant/build-rule)