一键导入
add-strategy
Adds a new trading strategy across 5 locations (mod.rs, routes, backtest, SDUI schema, frontend). Use when implementing a new strategy.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Adds a new trading strategy across 5 locations (mod.rs, routes, backtest, SDUI schema, frontend). Use when implementing a new strategy.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generates numbered SQL migration files for tables, indexes, and views. Use when adding or modifying database schema.
Crawls exchange API documentation and generates structured markdown specs. Use when integrating a new exchange or updating API specifications.
Systematically diagnoses build, runtime, DB, API, and frontend errors with classification and fix workflow. Use when encountering errors or test failures.
Commits code changes with automated CHANGELOG and design document updates. Runs build/lint verification before commit. Use after completing a feature, bug fix, or refactoring.
Scaffolds a new API endpoint with router, handler, OpenAPI docs, and TS bindings. Use when adding REST endpoints to trader-api.
Scaffolds a new exchange connector with connector, provider, and trait implementations. Use when integrating a new exchange.
| name | add-strategy |
| description | Adds a new trading strategy across 5 locations (mod.rs, routes, backtest, SDUI schema, frontend). Use when implementing a new strategy. |
| disable-model-invocation | true |
| user-invocable | true |
| argument-hint | <전략명_snake_case> [전략 설명] |
| allowed-tools | Read, Grep, Edit, Write, Bash(cargo *) |
| context | fork |
| agent | rust-impl |
새 전략 $ARGUMENTS[0]을 추가합니다.
⚠️ 반드시 5곳을 모두 수정해야 합니다. 하나라도 빠지면 런타임 에러가 발생합니다.
먼저 가장 유사한 기존 전략을 참고 자료로 읽습니다:
# 기존 전략 목록 확인
ls crates/trader-strategy/src/strategies/
추천 참조 전략: rsi.rs (가장 기본적인 구조)
위치: crates/trader-strategy/src/strategies/$ARGUMENTS[0].rs
use crate::traits::Strategy;
use trader_core::domain::{
context::StrategyContext,
signal::Signal,
};
use rust_decimal::Decimal; // f64 절대 금지!
pub struct YourStrategy {
// 파라미터 필드 (모두 Decimal)
}
impl Strategy for YourStrategy {
fn name(&self) -> &str { "your_strategy" }
fn on_market_data(
&mut self,
ctx: &StrategyContext,
) -> Vec<Signal> {
// 전략 로직
vec![]
}
}
rust_decimal::Decimal 사용 (f64 금지)unwrap() 미사용#[derive(TS)] + #[ts(export)] 추가 (응답 타입이 있으면)위치: crates/trader-strategy/src/strategies/mod.rs
pub mod $ARGUMENTS[0];
pub use $ARGUMENTS[0]::*;
위치: crates/trader-api/src/routes/strategies.rs
3곳을 수정합니다:
create_strategy_instance() — match 분기에 전략 추가get_strategy_default_name() — 한글 이름 반환get_strategy_default_timeframe() — 기본 타임프레임get_strategy_default_symbols() — 권장 심볼 목록위치: crates/trader-api/src/routes/backtest/engine.rs
run_strategy_backtest() 또는 run_multi_strategy_backtest() match 분기에 추가위치: config/sdui/strategy_schemas.json
strategies 객체에 전략 스키마 추가 (~50줄):
type, min, max, default, step 등위치: frontend/src/pages/Strategies.tsx
getDefaultTimeframe() switch 문에 case 추가
# 1. 컴파일 확인
cargo check -p trader-strategy
cargo check -p trader-api
# 2. 테스트 실행
cargo test -p trader-strategy -- $ARGUMENTS[0]
# 3. Clippy
cargo clippy -p trader-strategy -p trader-api -- -D warnings
모든 검증 통과 후 사용자에게 결과를 보고합니다.