AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Quant Trading

skill-miles990-claude-domain-skills-quant-trading · by miles990

量化交易策略開發、回測與風險管理

No reviews yet
0 installs
34 views
0.0% view→install

Install

$ agentstack add skill-miles990-claude-domain-skills-quant-trading

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-miles990-claude-domain-skills-quant-trading)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
8mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Quant Trading? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

量化交易 Quant Trading

> 系統化、數據驅動的交易策略開發

適用場景

  • 開發交易策略(趨勢跟蹤、均值回歸、套利)
  • 策略回測與績效分析
  • 風險管理與部位控制
  • 因子研究與 Alpha 挖掘

策略開發流程

假說形成 → 數據準備 → 策略編寫 → 回測驗證 → 風險控制 → 實盤監控

核心知識

策略類型

| 類型 | 說明 | 風險 | |------|------|------| | 趨勢跟蹤 | 順勢而為,追漲殺跌 | 震盪市場虧損 | | 均值回歸 | 價格偏離後回歸 | 趨勢市場虧損 | | 統計套利 | 配對交易、價差收斂 | 相關性崩潰 | | 高頻交易 | 微秒級別的價差捕捉 | 技術風險高 |

風險指標

| 指標 | 公式 | 良好標準 | |------|------|----------| | 夏普比率 | (收益 - 無風險) / 標準差 | > 1.5 | | 最大回撤 | 峰值到谷值的最大跌幅 | 1.0 | | 勝率 | 獲利交易 / 總交易 | > 50% |

常見因子

| 因子 | 說明 | 邏輯 | |------|------|------| | 價值 | P/E, P/B 低 | 便宜股票長期表現好 | | 動量 | 過去漲的繼續漲 | 趨勢持續性 | | 品質 | ROE 高、負債低 | 好公司溢價 | | 規模 | 小型股溢價 | 流動性補償 | | 波動 | 低波動異常 | 低風險高報酬 |

回測檢查清單

  • 數據品質: 是否有生存者偏差?
  • 前視偏差: 是否使用了未來數據?
  • 過度擬合: 參數是否過度優化?
  • 交易成本: 是否包含手續費、滑價?
  • 樣本外測試: 是否保留測試集?

最佳實踐

  1. 先簡單後複雜 - 從簡單策略開始,逐步增加複雜度
  2. 樣本外驗證 - 永遠保留一段數據做最終測試
  3. 考慮交易成本 - 回測時加入真實的手續費和滑價
  4. 分散風險 - 不要把所有資金押在單一策略
  5. 持續監控 - 實盤後監控策略表現,設定停損條件

常見錯誤

| 錯誤 | 正確做法 | |------|----------| | 回測收益驚人就上線 | 檢查是否過度擬合 | | 忽略交易成本 | 加入真實手續費和滑價 | | 用全部數據訓練 | 分割訓練/驗證/測試集 | | 單一策略 All-in | 多策略組合分散風險 |

Sharp Edges

SE-1: 回測過度擬合

  • 嚴重度: critical
  • 情境: 策略在回測中表現優異(夏普 > 3),但實盤虧損
  • 原因: 參數針對歷史數據過度優化,捕捉的是噪音而非信號
  • 症狀: 回測夏普 > 3、實盤表現 ma.shift(1)`

SE-3: 生存者偏差

  • 嚴重度: high
  • 情境: 只使用當前存在的股票進行回測
  • 原因: 退市、下市的股票被排除,導致高估策略表現
  • 症狀: 回測報酬明顯高於實際、小型股策略表現特別好
  • 解決: 使用包含退市股票的完整數據庫、使用 Point-in-Time 數據

SE-4: 忽略交易成本與滑價

  • 嚴重度: high
  • 情境: 高頻換手策略看起來很賺錢
  • 原因: 沒有計入手續費和滑價,實際成本吃掉所有利潤
  • 症狀: 年換手率 > 1000%、單筆獲利 < 0.5%、回測用收盤價成交
  • 解決: 計入 commission (0.1%) + slippage (0.2%) = 每筆 0.3%

SE-5: 過度自信於樣本內績效

  • 嚴重度: medium
  • 情境: 只看樣本內回測結果就決定上線
  • 原因: 沒有保留獨立的測試集
  • 症狀: 沒有 out-of-sample 測試、驗證集被重複使用、測試集數據量太少
  • 解決: 數據分割 60/20/20(訓練/驗證/測試),測試集只用一次

風險管理框架

Layer 1 交易層: 單筆停損 2%、根據波動度設定停利、移動停損保護利潤 Layer 2 策略層: 單策略不超過 20% 總資金、回撤超 15% 減半部位 Layer 3 組合層: 每日 VaR 不超過 2%、壓力測試、保持 20% 現金

Kelly 公式

f* = (p × b - q) / b
f* = 最佳投注比例, p = 勝率, q = 敗率, b = 賠率
範例:勝率 55%, 賠率 1.5 → f* = 25%(實務用 Half-Kelly 12.5%)

執行風險

| 風險 | 說明 | 對策 | |------|------|------| | 滑價 | 成交價與預期價差異 | 限價單、分批執行 | | 流動性 | 無法成交足夠數量 | 避免小型股、設定上限 | | 系統故障 | 程式/網路中斷 | 備援系統、人工監控 | | 黑天鵝 | 極端事件 | 部位上限、停損機制 |

工具推薦

  • Backtrader - Python 回測框架
  • QuantConnect - 雲端量化平台
  • TradingView - 圖表分析和策略測試
  • Zipline - Quantopian 開源回測引擎

延伸資源

  • 程式碼範例: [extended/code-examples.md](extended/code-examples.md)
  • 模板與 Checklist: [extended/templates.md](extended/templates.md)

參考資源

  • Quantitative Trading - Ernest Chan
  • Advances in Financial Machine Learning - Marcos Lopez de Prado

免責聲明

量化交易涉及高風險,歷史績效不代表未來表現。本內容僅供教育參考,不構成投資建議。

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.