01 · 投資研究系統01 · Investment research systems

AI 回測工作枱AI backtest workbench

角色Role
產品規格、驗證設計與驗收把關Product specification, validation design and acceptance control
狀態Status
開發中In development
起始Since
2026 年 10 月起Since October 2026
工具與技術Tools
Electron · TypeScript · SQLiteElectron · TypeScript · SQLite
一個 Windows 桌面程式:貼上一段交易策略,AI 翻成明確規則,在本機用歷史價格試跑。重點不是跑得快,而是結果可重現、不會騙自己。A Windows desktop app: paste a trading strategy, AI turns it into explicit rules, and it is run locally on historical prices. The point is not speed but results that can be reproduced and that do not fool their author.

1 分鐘短片:先講回測常見漏洞,再看系統怎樣堵住 · 片中驗收記錄為真實運行結果1-minute video: common backtest flaws, then how the system blocks them · the acceptance record shown is a real run

解決什麼問題The problem

回測(用歷史數據試跑策略)很容易「看起來賺錢」卻不可信:不小心用了未來的數據、忽略手續費和滑價(實際成交價與預期價的差距)、事後挑一段好看的時間、同一個策略反覆調到好看為止。投資者和僱主真正需要的,是一個能說明「這個結果為什麼可信」的流程。Backtesting (running a strategy on historical data) can easily look profitable without being trustworthy: future data sneaks in, fees and slippage are ignored, a flattering period is picked afterwards, or the same strategy is tuned until it looks good. What an investor or employer really needs is a process that can show why a result can be trusted.

使用流程How it is meant to work

  1. 貼上策略。用日常語言描述策略(AI 經我的 ChatGPT 訂閱登入使用,不需要 API key)。Paste a strategy. Describe it in plain language (the AI is used through my ChatGPT subscription login, so no API key is needed).
  2. 確認理解。AI 把策略翻譯成明確規則,我檢查它有沒有理解錯,確認後規則才固定下來。Confirm the reading. The AI translates the strategy into explicit rules and I check it understood correctly; only then are the rules frozen.
  3. 本機回測。在本機用歷史價格逐根 K 線試跑,費用和滑價按真實規則計算,同一輸入永遠得出同一結果。Run locally. The strategy is run bar by bar on historical prices on my own machine, fees and slippage are charged by real rules, and the same input always produces the same result.
  4. 比較時段和市況。不同回測窗口(全期、1 年、2 年、自訂)各自獨立跑,並按牛市/熊市/橫行分組看。Compare periods and regimes. Each backtest window (full, 1 year, 2 years, custom) runs independently and trades are grouped by bull, bear and sideways markets.
  5. 輸出可追溯報告。看得明的報告加 CSV/Excel 證據,報告上每個數字都指回同一份來源。Traceable report. A readable report plus CSV/Excel evidence, with every number on screen pointing back to the same source.

目前以合成數據驗證。Currently validated on synthetic data.

展示什麼能力What it demonstrates

  • 產品規格:把「嚴謹回測」拆成可驗收的要求,每個要求有編號、有對應的檢查。Product specification: breaking “rigorous backtesting” into numbered, checkable requirements.
  • 嚴謹驗證設計:突變測試(故意改壞程式,確認測試真的會報錯)、偷看未來數據測試、決定性重播。Validation design: mutation testing (deliberately breaking the code to prove the tests notice), look-ahead tests, deterministic replay.
  • 驗收把關:每一步都要經獨立 AI 審查,通過才合併;多個 AI 分工,實作做不到時改由別的 AI 或我直接做。Acceptance control: every step goes through independent AI review before merging; work is split across several AIs, and when one cannot finish, another takes over.
  • 數據授權意識:發現 TradingView 條款只准顯示、不准程式拿數據計算後,改為由我親自匯出 CSV、本機匯入(2026-10-17 起草、10-20 批准)。Awareness of data licensing: when TradingView's terms turned out to allow display but not computation, the design changed to CSV files I export myself and import locally (drafted 2026-10-17, approved 2026-10-20).

重點數字Key facts

  • 1,129 個自動測試;總驗收一次過跑 1,877 項檢查,全部通過。1,129 automated tests; the final acceptance run executes 1,877 checks, all passing.
  • 17 個真實植入的錯誤全部被測試捉到。All 17 deliberately planted bugs are caught by the tests.
  • 1,000 次「改動未來 K 線」測試證明過去的結果不變;種入 6 種偷看未來的錯誤全部被捉到。1,000 “alter the future bars” tests show past results do not change; all 6 kinds of planted look-ahead bugs are caught.
  • 同一批歷史回測可用保留的舊版程式逐位元重算,與記錄吻合。A past backtest can be recomputed bit for bit with the preserved earlier code and matches the record.
  • 研究紀錄採加密、只增不改的帳本。Research records are kept in an encrypted, append-only ledger.

工具與技術Tools and technology

Electron(桌面程式)、TypeScript、內建 SQLite、Node 沙盒重播;AI 經 ChatGPT 訂閱登入;以 Claude 與 Codex 分工開發。Electron (desktop app), TypeScript, built-in SQLite and Node sandbox replay; AI through a ChatGPT subscription login; built with Claude and Codex sharing the work.