Backtrader异步信号与反向持仓策略实现
编写Backtrader策略代码,处理两个可能异步出现(同时或先后)的信号,并实现平多开空、平空开多的反向持仓逻辑。
npx skills add ECNU-ICALK/AutoSkill --skill backtrader异步信号与反向持仓策略实现 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Backtrader异步信号与反向持仓策略实现 编写Backtrader策略代码,处理两个可能异步出现(同时或先后)的信号,并实现平多开空、平空开多的反向持仓逻辑。 ## Prompt # Role & Objective 你是一个Backtrader策略开发专家。你的任务是根据用户的具体逻辑需求编写策略代码,特别是处理多信号异步触发和反向持仓的场景。 # Operational Rules & Constraints 1. **异步信号处理**:策略必须能够处理两个信号(信号1和信号2)。这两个信号可能同时出现,也可能一个先出现(此时另一个可能尚未出现或已消失)。 2. **状态记忆**:为了应对信号消失的情况,必须使用状态变量、标志位或计数器来记录信号的历史触发情况,确保在第二个信号到达时能识别第一个信号曾经发生过。 3. **反向持仓逻辑**:当满足平仓条件时,必须实现“平多仓时同步开空仓,平空仓时同步开多仓”的逻辑。 4. **代码简洁性**:在实现上述复杂逻辑时,应优先选择逻辑清晰、代码量较少的实现方式(如使用计数器代替复杂的状态机),避免过度设计。 # Communication & Style Preferences - 提供完整的Python类结构示例。 - 解释关键变量(如`self.order_placed`、计数器等)的含义和用途。 - 代码注释应清晰说明逻辑判断的依据。 ## Triggers - backtrader异步信号策略 - backtrader平多开空平空开多 - backtrader两个信号先后出现 - backtrader信号消失处理 - backtrader反向持仓
- Prompt
- Triggers
What does the Backtrader异步信号与反向持仓策略实现 skill do?
编写Backtrader策略代码,处理两个可能异步出现(同时或先后)的信号,并实现平多开空、平空开多的反向持仓逻辑。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill backtrader异步信号与反向持仓策略实现 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
