strategy-generate
Skill này làm gì
Skill này biến một ý tưởng giao dịch đơn giản thành một chiến lược hoạt động và kiểm thử nó trên dữ liệu quá khứ. Skill dành cho trader muốn thử ý tưởng mà không phải tự viết một công cụ backtest đầy đủ.
Khi nào nên dùng
- ✓Khi bạn mô tả một ý tưởng giao dịch và muốn nó được biến thành chiến lược có thể kiểm thử.
- ✓Khi bạn muốn thay đổi một chiến lược hiện có và xem kết quả thay đổi thế nào.
- ✓Khi bạn muốn một backtest với các chỉ số rõ ràng và một đánh giá trung thực về kết quả.
Liên kết skill
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/strategy-generate/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xây dựng chiến lược mua khi đường trung bình 20 ngày cắt lên trên đường trung bình 60 ngày, rồi backtest trên Apple.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill viết một file cấu hình và một script tín hiệu, kiểm tra mã để tìm lỗi, rồi chạy backtest có sẵn. Sau đó nó đánh giá các chỉ số và báo cáo kết quả một cách rõ ràng, kể cả kết quả kém.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Workflow
- Requirements parsing: parse user intent, extract instrument codes, time range, and strategy logic, then write
config.json - Strategy design: think through the 5 questions of data / signal / position sizing / backtest / validation
- Strategy coding: write
code/signal_engine.py(following theSignalEnginecontract) - Syntax check:
bash("python -c \"import ast; ast.parse(open('code/signal_engine.py').read()); print('OK')\"") - Run backtest: call the
backtesttool (built into the engine; no need to writerun_backtest.py) - Evaluate results: use the backtest tool's structured metrics, validation and artifact summary. Read
artifacts/metrics.csvor targeted rows withread_run_artifactonly when the requested evidence is missing from that summary. Judge by the review criteria and report failures honestly. - Fix implementation errors: repair code/contract errors and rerun to verify. Poor returns in a correctly implemented strategy are a valid result: report them and stop. Change the strategy or test additional candidates only when the user requested optimization or comparison, within their specified scope. Deeper attribution and robustness research are performed when requested, not added to every backtest.
You only need to write signal_engine.py and config.json. The backtest tool automatically handles data loading and backtest execution.
Adapting a registered strategy
- Read
get_strategy_evidence(strategy_id="sdm:...")for the parent's description and computed regime definitions. A stale, disabled, decayed or inadequately evidenced parent cannot be adapted. - Call
adapt_strategy(strategy_id=..., name=..., universe=..., config=...)with explicit codes and date window. Only name, universe and optional position sizing may change. Signal definition, entry and exit rules remain the parent's. Missing inputs require a question, never a fabricated metric or threshold. - Use the returned assigned
run_dirand seededconfig.json. Generate the child'scode/signal_engine.pyfrom its description using the contract below; never copy a parent run's metrics. Preserve the bound codes, dates andstrategy_adaptationmetadata. Record model provenance through the normal write tool. - Call
backtest(run_dir=...), inspect its artifacts, thenrefresh_strategy_evidence(runs=[{"strategy_id": "sdm:<child>", "run_dir": "<assigned>"}], scope="strategies"). This updates only successful named strategies and preserves the parent's evidence. Refresh refuses a different run or changed config/code/results against the run card. - Read the child's evidence and report its actual quality, cost and decay warnings. A successful backtest is not adequate regime evidence or independent approval. An unchanged mathematical signal can legitimately generate identical code for another universe; hashes establish provenance, not semantic correctness of generated Python.
Requirements Parsing
Extract the following from the user's description:
- Instrument codes: process them according to the normalization rules below
- Time range: if the user does not specify dates, default to 10 years back from today (for example, if today is
2026-03-18, thenstart_date=2016-03-18,end_date=2026-03-18) - Indicator warm-up: a long lookback (MA200, a 252-day z-score) needs bars from before the requested period. Move
start_dateback to load them and declare the boundary withwarmup_bars— the requested period is what gets graded, and undeclared warm-up bars are graded too. Silently backdatingstart_dateby a year turns a 10-year backtest into an 11-year one that still calls itself 10 years: the extra year's trades, CAGR and benchmark all enter the report, the run succeeds, and the numbers look internally consistent - Strategy logic: entry / exit conditions and indicator parameters
If critical information is missing, you must ask the user instead of guessing:
- Instrument not specified → ask which instrument they want to backtest (offer several popular suggestions)
- Strategy description is vague (for example, "help me build a strategy") → provide 2-3 strategy directions for the user to choose from
- Mixed markets but not clearly specified → confirm the data source
Write config.json first, then write code. config.json must be placed in the root of run_dir.
Strategy Design
Before writing code, think through these 5 questions:
- **Data
Câu hỏi thường gặp
Tôi có cần tự viết mã backtest không?
Không. Skill chỉ viết logic tín hiệu và cấu hình, còn công cụ backtest lo phần còn lại.
Nếu chiến lược thua lỗ thì sao?
Skill báo cáo trung thực, vì kết quả kém từ một chiến lược được xây dựng đúng cách vẫn là một kết quả hợp lệ.
Skill có tối ưu chiến lược của tôi không?
Có, nhưng chỉ khi bạn yêu cầu tối ưu hoặc so sánh, và trong phạm vi bạn đã đặt.
Chi tiết
Mô tả gốc của tác giả
Create, modify, and optimize quantitative trading strategies, then backtest and evaluate them.
repo: HKUDS/Vibe-Trading
Độ phổ biến
- Sao GitHub
- 37k
- Vị trí xếp hạng
- #7558
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
vibe-trading
37kCho agent của bạn bộ công cụ nghiên cứu tài chính đầy đủ: backtest, phân tích nhân tố, định giá quyền chọn và dữ liệu thị trường nhiều nước.
adr-hshare
37kChỉ cho agent của bạn cách so sánh giá của một công ty Trung Quốc được niêm yết ở nhiều thị trường, như ADR ở Mỹ và cổ phiếu ở Hồng Kông.
akshare
37kCho agent của bạn lấy dữ liệu thị trường miễn phí: cổ phiếu Trung Quốc và toàn cầu, tương lai, ngoại hối, chỉ số kinh tế, không cần API key.
alpha-zoo
37kCho agent của bạn duyệt thư viện nhân tố cổ phiếu dựng sẵn và kiểm tra cả một nhóm nhân tố dự đoán lợi nhuận tốt đến đâu trên thị trường đã chọn.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.