ワンクリックで
strategy-generate
Create, modify, and optimize quantitative trading strategies for Vietnam stocks, then backtest and evaluate them.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Create, modify, and optimize quantitative trading strategies for Vietnam stocks, then backtest and evaluate them.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Candlestick pattern recognition engine, pure pandas vectorized implementation of 15 classic candlestick patterns (5 single-candle + 5 double-candle + 4 triple-candle + 1 trend confirmation), generating a composite signal from bullish/bearish pattern scores.
基于缠论(缠中说禅)的形态识别引擎,使用czsc库自动检测K线分型、笔、中枢,并生成一买/一卖/二买/二卖/三买/三卖等买卖点信号。支持多周期分析和形态分类(3/5/7/9/11笔形态)。
A股可转债分析——转股/纯债/期权三维估值、下修/强赎/回售博弈、双低策略与转债轮动选债框架
公司事件驱动分析:并购套利价差计算、大股东增减持信号、股权激励解读、定增配股影响评估、A股ST/退市预警
Data source selection — VN-only. All data comes from vnstock (fundamentals + OHLCV) and VietFin DNSE (OHLCV fallback).
Elliott Wave Theory signal engine. Detects swing points through Zigzag, matches 5-wave impulse and 3-wave corrective structures, validates them with Fibonacci wave relationships, and generates trend-top / correction-complete signals. Pure in-house pandas implementation.
| name | strategy-generate |
| description | Create, modify, and optimize quantitative trading strategies for Vietnam stocks, then backtest and evaluate them. |
| category | strategy |
config.jsoncode/signal_engine.py (following the SignalEngine contract)bash("python -c \"import ast; ast.parse(open('code/signal_engine.py').read()); print('OK')\"")backtest tool (built into the engine; no need to write run_backtest.py)artifacts/metrics.csv and judge by the review criteriaedit_file → run backtest → re-evaluateYou only need to write signal_engine.py and config.json. The backtest tool automatically handles data loading and backtest execution.
Extract the following from the user's description:
If critical information is missing, you must ask the user instead of guessing:
Write config.json first, then write code. config.json must be placed in the root of run_dir.
Before writing code, think through these 5 questions:
vn_factor_data first then pass CSVs to factor_analysis.SignalEngine Contractclass SignalEngine:
def generate(self, data_map: Dict[str, pd.DataFrame]) -> Dict[str, pd.Series]:
"""
Args:
data_map: code -> DataFrame (columns: open, high, low, close, volume, DatetimeIndex)
Returns:
code -> signal Series, value range [-1.0, 1.0]
1.0 = fully long, 0.5 = half position, 0.0 = flat, -1.0 = fully short
Portfolio strategy: selected stocks split weights equally (e.g. top 10 -> each 0.1)
Legacy integer signals {-1, 0, 1} remain compatible
"""
Hard constraints:
Series index must align exactly with the input DataFrame indexnumpy, pandas, and so on)config.json)if __name__ == "__main__" blockSelf-check after writing signal_engine.py:
numpy, pandas, typing, and so on)fillna(0) or skip[-1.0, 1.0]| Source | Config value | How |
|---|---|---|
| VietFin (vnstock fallback) | "vietfin" | Primary source for VN OHLCV + fundamentals |
| DNSE (broker) | "dnse" | Alternative VN OHLCV source |
| Auto | "auto" | Recommended — auto-selects best available source |
Do NOT use tushare, akshare, or okx — they are not supported.
config.json Format{
"source": "auto",
"codes": ["VCB"],
"start_date": "2020-01-01",
"end_date": "2025-12-31",
"interval": "1D",
"initial_cash": 1000000,
"commission": 0.001,
"extra_fields": null,
"fundamental_fields": null,
"optimizer": null,
"optimizer_params": {},
"engine": "daily",
"validation": null
}
source: "auto" (recommended) / "vietfin" / "dnse"interval: candlestick interval, default "1D"extra_fields: not supported for VN (use vn_factor_data tool instead)fundamental_fields: not supported (use vn_factor_data instead)optimizer: optional, one of "equal_volatility" / "risk_parity" / "mean_variance" / "max_diversification" / null (equal-weight by default)optimizer_params: optimizer parameters, such as {"lookback": 60}engine: backtest engine, default "daily"initial_cash: default 1,000,000commission: default 0.1%validation: optional statistical validationFor factor-based strategies: first call vn_factor_data(universe="vn-index", factor="pe"), then use the output CSVs with factor_analysis tool.
passed=false)artifacts/metrics.csv exists and is non-emptyartifacts/equity.csv exists and is non-emptyexit_code == 0 (backtest exits normally)equity column in equity.csv contains no NaN valuestrade_count > 0 (zero trades = signal bug)score ≥ 60 → passedscore ≥ 60 = passed=truetrade_count=0): signal-logic bug, conditions may be too strictaction_items FormatIf improvements are needed after evaluation, write action_items:
"Change X from A to B" or "Add X logic in signal_engine.py""Change short MA from 5 to 10 days to reduce whipsaw signals""Add stop-loss: force close when loss exceeds 5%""Add volume filter: only trigger buy on high volume days"