Skip to content

期權交易系統編程書籍

版本:2026年 9月 20日

如果你只買/只讀 一本,我會揀 Yves Hilpisch《Python for Finance, 2nd Edition》。原因唔係佢對期權理論鑽得最深,而係六本候選之中,佢最接近一條完整「research → pricing → risk → backtest → automated execution」學習路線:由 Python、NumPy、pandas、數值方法開始,去到隨機過程、歐式/美式期權、Monte Carlo、Least-Squares Monte Carlo、衍生品 portfolio valuation、market calibration,再另外有 algorithmic trading、vectorised backtesting、broker API 落盤、capital/risk management、deployment、logging 同 monitoring。O’Reilly 將它列作 Beginner、720 頁、2018 年第二版。python-for-finance

但如果你的真正重點係「期權 quantitative engine 本身」,即 implied volatility、波幅曲面、Fourier/FFT、Heston、jump diffusion、校準、動態 Delta hedging,而唔係交易基建,我會將 《Derivatives Analytics with Python》 評為理論與 Python 實作結合得最好的專書。Wiley 說明書中有超過 5,000 行 Python,涵蓋市場數據、risk-neutral valuation、Monte Carlo、模型 calibration、valuation 同 dynamic hedging;章節亦落實到 Fourier pricing、American options、Heston/jump models 同 hedging。citeturn8view0turn9view0turn9view2turn9view3

中文方面,今次檢索中最貼題而且資料最完整的是它的簡體中文版 《Python 金融衍生品大數據分析:建模、模擬、校準與對沖》,電子工業出版社,2017 年;內容包括 BSM、Greeks、CRR、隱含波幅、EURO STOXX 50 波幅資料、FFT、Merton、Longstaff–Schwartz、Heston、校準同動態對沖。不過台灣天瓏目前頁面標為「已絕版」,所以現階段較適合找圖書館、二手書,或者直接買英文 Wiley 版。citeturn8view3turn9view0turn9view2turn9view3

另一個重要結論係:我未找到一本現行中文/英文教材,可以同時深入教 option theory、volatility modelling、production-grade backtesting、options-specific execution 同實盤風控,而且每方面都講得深入。 最實際做法係以《Python for Finance》做主線,再用《Derivatives Analytics with Python》補足波幅與校準;到要做真正 event-driven options backtester/paper execution 時,再接 QuantLib 或 LEAN。QuantLib 官方定位本身就包括 modelling、trading 同 risk management,而且核心為 C++、有 Python/R 等 bindings;LEAN 則係開源 algorithmic trading engine,支援 research/backtest/live workflow。citeturn20search27turn22search3turn22search16

最終排序:

  1. 最佳單一本: Python for Finance, 2nd Edition
  2. 最佳期權 quantitative 深度: Derivatives Analytics with Python
  3. 最新、最現代化 quant 補充: Quantitative Finance with Case Studies in Python
  4. 最佳交易基建補充: Python for Algorithmic Trading
  5. 最佳 C++ pricing-engine 架構: C++ Design Patterns and Derivatives Pricing
  6. 最佳較現代 C++ numerical-pricing 參考: Financial Instrument Pricing Using C++

以下「優點/缺點」屬於我根據出版社目錄、作者程式碼、版本年份同你的「期權交易系統」用途作出的評估;並唔係出版社自己的評分。

書籍適合程度、先修語言/libraries/frameworks實作範圍優點缺點版本、購買
Python for Finance, 2nd Edition — Yves Hilpisch出版社:Beginner;我會定位為 beginner→intermediate。官方未列數學先修;有 Python 基礎章,所以毋須先係專業 Python programmer。Python;NumPy、pandas、Numba、Cython;ML 部分有 scikit-learn、TensorFlow;FXCM API;Jupyter/IPython workflow。Binomial trees、Monte Carlo、European/American options、LSM、risk measures、derivatives portfolio、market calibration;另外有 trading strategy、vectorised backtesting、order placement、automated trading、leverage/risk、deployment、logging/monitoring。citeturn21view3最完整的一本式路線;由 programming 到 derivatives 再到 trading infrastructure,最吻合「我要自己砌系統」。期權 vol surface/Heston calibration 深度不及 DAWP;broker integration 係 2018 年教材內容,2026 實作應當將它視作 architecture pattern,再核對現時 broker API。2nd ed., Dec 2018, 720 pp. citeturn21view3 O’Reilly 官方頁
Derivatives Analytics with Python — Yves Hilpisch我評為 Intermediate→Advanced;出版社沒有明確 level/正式先修要求。最好已有 Python、微積分、概率同基本期權概念。Python、IPython/Jupyter;官方 companion code。作者 repository 同時保留較舊 Python 3.6/2.7 時代代碼,所以實作時要現代化 dependencies。citeturn5search0BSM/Greeks、CRR、implied vol、volatility surface、Monte Carlo、American LSM、Fourier/FFT、Carr–Madan、Heston、jump diffusion、model calibration、dynamic hedging。citeturn8view0turn9view0turn9view2turn9view3六本之中最 options-centric;由 pricing 直接去 calibration、surface 同 hedging,亦有大量實碼。幾乎唔係一本 trading-system/execution 教科書;backtesting、order management、broker execution 要自己補。原碼環境較舊。First published 5 Jun 2015. citeturn8view0 Wiley 官方頁;作者 code
Quantitative Finance with Case Studies in Python — Chris KelliherIntermediate→Advanced/研究院入門;出版社描述為適合 quantitative finance 類碩士一年級學生。正式先修細節:未標明。citeturn22search12Python/Jupyter notebooks;出版社/作者提供免費 code repository;出版社介紹頁沒有完整列出 package inventory,因此其餘 libraries:未標明。citeturn22search2turn22search27Options pricing、derivative pricing、portfolio management/optimization、hedging、risk、ML/AI;新版加入 data science/AI、LLM、SOFR 等更新。citeturn22search5turn22search12最新的一本候選;案例較貼近現代 quant workflow,適合作 2018 Hilpisch 書之後的更新閱讀。唔係專門 options engine 書;出版社描述沒有顯示它會完整教 options-specific event backtester、assignment、broker execution。作者 code repo 稱新版為 2nd edition;出版資料顯示 3 Dec 2025。citeturn22search2turn22search8 Taylor & Francis 官方頁;新版 code
Python for Algorithmic Trading — Yves HilpischO’Reilly 標示 Intermediate–Advanced。適合已識基本 Python/finance。citeturn8view1Python;NumPy、pandas、scikit-learn、TensorFlow;OANDA/FXCM API;實時 streaming、order interface。citeturn8view1SMA、momentum、mean-reversion、vectorised backtesting、ML、real-time data、order placement、Kelly/leverage、risk、deployment、logging/monitoring。citeturn8view1六本中對 backtest → live/paper execution → operations 講得最直接,係 DAWP 很好的「另一半」。唔係期權理論書:pricing、Greeks、IV surface、Heston 都唔係核心;所以唔建議單獨用它學 options。Nov 2020, 378 pp. citeturn8view1 O’Reilly 官方頁;作者 code
C++ Design Patterns and Derivatives Pricing, 2nd Edition — Mark S. JoshiIntermediate→Advanced。Stevens 課程以它作教材,要求 basic C++ 同 mathematical finance,並以實作 OO derivatives pricing model 為學習成果。citeturn10search17C++;重點係 object-oriented design patterns/reusable pricing architecture。第三方 pricing library:官方資料 未標明。衍生品定價程式設計、可重用 payoff/pricing components、OO pattern-driven engine;execution/backtesting:不是核心。citeturn10search6turn10search17非常適合學「點樣將 option formula 變成一個可擴充 library」,對日後睇 QuantLib 架構有幫助。第二版係 2008,早於 C++11;因此適合學 abstraction/design,多過照搬現代 C++ syntax/tooling。2nd ed., May 2008。citeturn10search6 Cambridge University Press 官方頁
Financial Instrument Pricing Using C++, 2nd Edition — Daniel J. DuffyIntermediate→Advanced;正式 publisher prerequisite:未標明。適合已識 C++ 同基本 quantitative finance。C++/C++11-era;templates、numerical finance;第三方 library 明細:未標明。作者曾指出第二版相關章節包括 templates 同 Black–Scholes。citeturn13search5Pricing-engine/numerical implementation、Black–Scholes 等;重點是 financial-instrument pricing,而不是 end-to-end trade execution。比 Joshi 更適合想深入 numerical C++ pricing engineering 的人;Wiley 有正式第二版。對 Python researcher 學習曲線較高;options backtesting/live execution 並非主軸。2nd ed.; Wiley e-book Sep 2018, ISBN 978-1-119-17048-8。citeturn13search17 Wiley 官方頁

最值得優先指出的是 《Python 金融衍生品大數據分析:建模、模擬、校準與對沖》。它是 Derivatives Analytics with Python 的簡體中文譯本,作者 Yves Hilpisch,電子工業出版社,出版日期 2017-08-01,ISBN-13 9787121313363,321 頁;目錄明確包括 BSM、Greeks、CRR、隱含波幅、EURO STOXX 50、Lewis/Carr–Madan Fourier methods、FFT、Merton、American option LSM、Heston/BCC97 calibration 同 dynamic hedging。citeturn8view3turn9view0turn9view2turn9view3

購買方面,天瓏目前把這個版本標為「已絕版」;電子工業出版社是原中文出版者,但今次檢索沒有找到一個仍可直接下單的出版社個別商品頁,所以「官方現貨購買渠道」屬 未確認/未標明。citeturn8view3
天瓏書頁 | 電子工業出版社

另外,QuantLib 官方文件頁亦明確列出 Luigi Ballabio 的 《Implementing QuantLib》有中文譯本,譯者名以 “Xu Ruilong” 列示;同一頁亦列有 A QuantLib Guide、QuantLib Python Cookbook。中文版本的確實出版日/版次在該官方頁 未標明。對已經識 pricing theory、想研究 production-style derivatives library internals 的人,這本值得列作進階補充,而唔係第一本入門書。citeturn20search8

我會揀《Python for Finance, 2nd Edition》

Section titled “我會揀《Python for Finance, 2nd Edition》”

你的要求其實有兩條知識鏈:

期權數學
↓
Pricing → Greeks → IV → stochastic models → calibration → hedging
交易系統
↓
Data → signals → backtest → portfolio/risk → execution → monitoring

大部分期權書只覆蓋第一條;大部分 algorithmic-trading 書只覆蓋第二條。Python for Finance 的特別之處係兩條都有:它的 Part IV 有 trading platform、API、historical/streaming data、orders、backtesting、automated trading、risk analysis 同 deployment,而 Part V 又有 risk-neutral valuation、GBM/jump/square-root processes、European/American valuation、LSM、portfolio valuation 同 options calibration。citeturn21view3

所以,如果目標係 十二星期後手上有一個可運行的 options research/paper-trading system,它比一本純 stochastic-calculus 書更加適合做 spine textbook。相反,如果你的職涯方向係 sell-side derivatives quant/model validation/volatility quant,我會把優先次序倒轉:先 Derivatives Analytics with Python,再讀 QuantLib/C++。這個判斷建基於兩本書的實際內容分工:DAWP 明顯更深入 Fourier、stochastic volatility、jump models、market calibration 與 dynamic hedging,而 Python for Finance 的範圍更闊。citeturn8view0turn9view0turn9view2turn9view3turn21view3

假如唔限制只讀一本,我會用:

主線: Python for Finance, 2nd Edition
深挖: Derivatives Analytics with Python/中文譯本

然後將書中較舊嘅 infrastructure code 換成現代 stack:

NumPy / SciPy / pandas
↓
自寫 Black-Scholes + Greeks + IV
↓
QuantLib 作獨立 benchmark
↓
自寫 event-driven backtester 或 LEAN
↓
paper broker adapter
↓
risk limits + monitoring

QuantLib 官方把自身描述為一個用於 real-world quantitative finance modelling、trading 同 risk management 的 free/open-source framework,核心以 C++ 寫成並輸出至 Python、R 等語言;LEAN 官方則提供 research、backtest、optimization 同 live-trading workflow,亦有 Interactive Brokers live-trading integration 文件。citeturn20search27turn22search6turn22search9

唔建議只背書入面公式。到你實作某個核心演算法時,最好至少睇一次原始論文,因為咁樣比較容易分得清楚「模型假設」、「數值近似」同「作者程式設計選擇」。

演算法/模型原始來源你應該實作到甚麼程度
Black–ScholesFischer Black & Myron Scholes, The Pricing of Options and Corporate Liabilities, JPE 81(3), 1973,頁 637–654;University of Chicago Press 的原始頁面說明以 no-arbitrage portfolio 原理導出 valuation formula。citeturn17search3turn17search6 Publisher/DOI價格、Delta、Gamma、Vega;有限差分驗證 Greeks;put-call parity tests。
CRR binomial treeCox, Ross & Rubinstein, Option Pricing: A Simplified Approach, JFE 7(3), Sep 1979, 229–263。citeturn19search10turn19search29 DOIEuropean + American call/put;步數收斂;early-exercise boundary。
Heston stochastic volatilitySteven Heston, A Closed-Form Solution for Options with Stochastic Volatility…, RFS 6(2), 1993, 327–343。citeturn19search16 DOIcharacteristic-function pricer;參數 calibration;跟 BSM implied-vol smile 比較。
Least-Squares Monte CarloLongstaff & Schwartz, Valuing American Options by Simulation: A Simple Least-Squares Approach, RFS 14(1), 2001, 113–147;方法以 least-squares estimate continuation value。citeturn18search24turn18search4 DOIAmerican put;basis functions;同 CRR benchmark 比較誤差。
Carr–Madan FFTCarr & Madan, Option Valuation Using the Fast Fourier Transform, Journal of Computational Finance 2(4), 1999;文中用 characteristic function + FFT 做 numerical option valuation。citeturn18search7 DOI一次計算多個 strikes;跟直接 integration/BSM benchmark 比速度及 error。

QuantLib 應該係最重要的「正確答案 benchmark」。唔好一開始就用它代替自己寫 BSM、tree 同 LSM;先自己寫,再用 QuantLib cross-check。官方確認 QuantLib 是 free/open-source、C++ 核心並有 Python/R 等 bindings。citeturn20search27turn20search20

NumPy、SciPy、pandas 適合作為數值陣列、root-finding/optimization 同 option-chain tabular data 的基礎 stack;以下程式範例亦用 SciPy 求 implied volatility。

LEAN/QuantConnect Lean GitHub 適合在後段練 event-driven backtesting 同 paper/live execution;官方將 LEAN 稱為 QuantConnect 背後的 open-source algorithmic trading engine,而 CLI 文件涵蓋 backtest、optimize、research 同 live brokerage workflows。citeturn22search3turn22search6turn22search16

書本程式碼: DAWP 作者 repo、Python for Algorithmic Trading repo、Kelliher 新版 repo。前者作者 repo 明確保存該書 Python/Jupyter code,但版本屬較舊 Python 環境,所以最好逐個 notebook port 到你自己的現代環境,而唔係直接鎖死舊 dependency。citeturn5search0turn3search9turn22search2

我建議十二星期唔好以「讀完幾多頁」做 KPI,而係每星期一定交出一件 可測試 software artefact。主線對應 Python for Finance 的 NumPy/pandas、numerical tools、stochastics、algorithmic trading、derivatives valuation、portfolio valuation 同 calibration 章節;波幅/Heston 部分再由 DAWP 補強。citeturn21view3turn9view0turn9view2

flowchart LR
A[Option-chain data] --> B["Validation & normalisation"]
B --> C[BSM / CRR pricing]
C --> D["Greeks & implied volatility"]
D --> E[Volatility surface]
E --> F[Heston / alternative model calibration]
F --> G[Trading signal]
G --> H["Portfolio & hedge engine"]
H --> I[Event-driven backtest]
I --> J["Risk limits & stress tests"]
J --> K[Paper execution]
K --> L["Monitoring & performance report"]
星期主要工作最低交付物
Week 1建 repo、virtual environment、pytest、data model;定義 OptionContract、Quote、Position、Portfolio。讀 Python/NumPy/pandas/OOP 相關部分。src/, tests/, notebook folder;一個可以載入及 validate option-chain CSV/Parquet 的 pipeline。
Week 2由零寫 Black–Scholes call/put、put-call parity、Delta/Gamma/Vega。black_scholes.py + ≥20 個 unit tests;Greeks analytic vs finite-difference error report。
Week 3實作 CRR tree;European/American options;研究 convergence。binomial.py;畫出 tree steps 對 pricing error 的收斂圖;American put early-exercise tests。
Week 4實作 implied-vol solver;整理 option chain;建立 strike×expiry IV grid。implied_vol.py;每張合約有 IV + Greeks;異常報價/無解 case 有明確 error flag。
Week 5建 volatility-surface layer;先做 interpolation,再加入基本 static-arbitrage sanity checks。surface.py;surface heatmap;按 expiry 畫 smile/skew;out-of-sample interpolation test。
Week 6Monte Carlo:GBM、antithetic sampling;再做 Longstaff–Schwartz American put。原論文方法核心係 regress continuation value。citeturn18search24monte_carlo.py, lsm.py;LSM vs CRR pricing benchmark table。
Week 7實作 Heston characteristic-function pricer,或者先用 QuantLib Heston engine 做 reference;calibrate 到 IV/price quotes。Heston 原論文提供 stochastic-volatility closed-form framework。citeturn19search16heston.py;calibration objective、parameters、RMSE;model-vs-market smile chart。
Week 8定義一個研究用途策略,例如 delta-hedged long/short volatility signal。將「signal」同「pricing」完全分開。strategy.py;明確 entry/exit、rebalance、expiry-selection rules;不能用 future data。
Week 9做 event-driven backtester:quotes → signal → order → fill → positions → hedge → P&L。加入 bid/ask、fees、slippage assumptions 同 expiry lifecycle。backtest/engine.py;trade ledger、daily P&L、Greek exposure history。
Week 10寫 risk engine:portfolio Delta/Gamma/Vega、position limits、scenario shocks、drawdown/kill-switch。Python for Finance 本身包括 risk measures、portfolio valuation、capital/leverage/risk analysis。citeturn21view3risk.py;每個 timestamp 可輸出 Greeks + stress P&L;超限自動拒絕新 order。
Week 11接 paper-execution abstraction。可以自己寫 Broker interface,或者移植到 LEAN;LEAN 文件有 backtest-to-live workflow 同 IB integration。citeturn22search9turn22search16PaperBroker;order states:submitted/partial/filled/cancelled/rejected;reconciliation test。
Week 12Walk-forward/holdout 測試;整理所有 assumptions;比較 BSM、surface、Heston 的 model error 同策略結果;package repo。完整 README、architecture diagram、test coverage、research report、reproducible config、paper-trading demo。
options-system/
├── src/
│ ├── instruments.py
│ ├── black_scholes.py
│ ├── binomial.py
│ ├── implied_vol.py
│ ├── surface.py
│ ├── monte_carlo.py
│ ├── lsm.py
│ ├── heston.py
│ ├── portfolio.py
│ ├── risk.py
│ ├── strategy.py
│ ├── backtest/
│ │ ├── engine.py
│ │ ├── fills.py
│ │ └── costs.py
│ └── execution/
│ ├── broker.py
│ └── paper.py
├── tests/
├── notebooks/
├── data/
├── configs/
└── README.md

最關鍵的設計原則係 pricing model、strategy、risk manager、execution adapter 分開。咁你第七星期由 Black–Scholes 換 Heston,或者第十一星期由 PaperBroker 換 LEAN/IB adapter,都唔需要重寫整個策略。

下面呢段足夠做 Week 2–4 的起點:Black–Scholes price、主要 Greeks 同 implied-volatility inversion。Black–Scholes 的理論基礎來自 1973 原論文;DAWP 同 Python for Finance 都以 option valuation/BSM 類工具作後續 modelling 的基礎。citeturn17search3turn9view0turn21view3

from __future__ import annotations
from dataclasses import dataclass
from math import exp, log, sqrt
from scipy.optimize import brentq
from scipy.stats import norm
@dataclass(frozen=True)
class Greeks:
delta: float
gamma: float
vega: float
def _d1_d2(
spot: float,
strike: float,
maturity: float,
rate: float,
volatility: float,
dividend_yield: float = 0.0,
) -> tuple[float, float]:
if spot <= 0 or strike <= 0:
raise ValueError("spot and strike must be positive")
if maturity <= 0:
raise ValueError("maturity must be positive")
if volatility <= 0:
raise ValueError("volatility must be positive")
vol_sqrt_t = volatility * sqrt(maturity)
d1 = (
log(spot / strike)
+ (rate - dividend_yield + 0.5 * volatility**2) * maturity
) / vol_sqrt_t
d2 = d1 - vol_sqrt_t
return d1, d2
def bs_price(
spot: float,
strike: float,
maturity: float,
rate: float,
volatility: float,
option_type: str,
dividend_yield: float = 0.0,
) -> float:
"""Black-Scholes-Merton price for a European call or put."""
d1, d2 = _d1_d2(
spot, strike, maturity, rate, volatility, dividend_yield
)
disc_q = exp(-dividend_yield * maturity)
disc_r = exp(-rate * maturity)
if option_type == "call":
return (
spot * disc_q * norm.cdf(d1)
- strike * disc_r * norm.cdf(d2)
)
if option_type == "put":
return (
strike * disc_r * norm.cdf(-d2)
- spot * disc_q * norm.cdf(-d1)
)
raise ValueError("option_type must be 'call' or 'put'")
def bs_greeks(
spot: float,
strike: float,
maturity: float,
rate: float,
volatility: float,
option_type: str,
dividend_yield: float = 0.0,
) -> Greeks:
d1, _ = _d1_d2(
spot, strike, maturity, rate, volatility, dividend_yield
)
disc_q = exp(-dividend_yield * maturity)
if option_type == "call":
delta = disc_q * norm.cdf(d1)
elif option_type == "put":
delta = disc_q * (norm.cdf(d1) - 1.0)
else:
raise ValueError("option_type must be 'call' or 'put'")
gamma = (
disc_q * norm.pdf(d1)
/ (spot * volatility * sqrt(maturity))
)
# Vega here is change in option value per +1.00 change in volatility.
# Divide by 100 for "per 1 volatility point".
vega = spot * disc_q * norm.pdf(d1) * sqrt(maturity)
return Greeks(delta=delta, gamma=gamma, vega=vega)
def implied_volatility(
market_price: float,
spot: float,
strike: float,
maturity: float,
rate: float,
option_type: str,
dividend_yield: float = 0.0,
min_vol: float = 1e-6,
max_vol: float = 5.0,
) -> float:
"""Invert Black-Scholes price using a robust bracketed root solver."""
if market_price <= 0:
raise ValueError("market_price must be positive")
def objective(vol: float) -> float:
return bs_price(
spot=spot,
strike=strike,
maturity=maturity,
rate=rate,
volatility=vol,
option_type=option_type,
dividend_yield=dividend_yield,
) - market_price
try:
return brentq(objective, min_vol, max_vol)
except ValueError as exc:
raise ValueError(
"No implied-volatility root found inside the chosen bracket. "
"Check quote quality and no-arbitrage bounds."
) from exc
if __name__ == "__main__":
s = 100.0
k = 105.0
t = 30 / 365
r = 0.04
sigma = 0.25
theoretical = bs_price(s, k, t, r, sigma, "call")
recovered_iv = implied_volatility(
theoretical, s, k, t, r, "call"
)
greeks = bs_greeks(s, k, t, r, recovered_iv, "call")
print(f"Price: {theoretical:.4f}")
print(f"Recovered IV: {recovered_iv:.6f}")
print(greeks)

下一步唔應該即刻寫交易 signal,而係先寫 tests:

def test_iv_round_trip():
sigma = 0.23
price = bs_price(
spot=100,
strike=100,
maturity=0.5,
rate=0.03,
volatility=sigma,
option_type="call",
)
iv = implied_volatility(
market_price=price,
spot=100,
strike=100,
maturity=0.5,
rate=0.03,
option_type="call",
)
assert abs(iv - sigma) < 1e-8

到 Week 8–10,strategy/backtester 嘅介面反而應該保持簡單:

class Strategy:
def on_market(self, snapshot, portfolio, models):
"""
Read-only market + model state.
Return desired orders; do not mutate portfolio directly.
"""
return []
class RiskManager:
def approve(self, order, portfolio, market):
# Example policy:
# reject if projected position/Delta/Gamma/Vega
# exceeds configured limits.
return True
class Broker:
def submit(self, order):
raise NotImplementedError
for timestamp, snapshot in market_stream:
models.update(snapshot) # IV, Greeks, surface, etc.
desired_orders = strategy.on_market(
snapshot, portfolio, models
)
for order in desired_orders:
if risk_manager.approve(order, portfolio, snapshot):
broker.submit(order)
fills = broker.process(snapshot)
portfolio.apply(fills)
portfolio.mark_to_market(snapshot)
risk_log.write(
timestamp=timestamp,
delta=portfolio.delta(models),
gamma=portfolio.gamma(models),
vega=portfolio.vega(models),
pnl=portfolio.pnl,
)

呢個結構同書本最大的分別係:你唔係「做幾個 notebook 計 option price」就停,而係有意識地將 定價 → model state → signal → risk → order → fill → portfolio accounting 變成清晰邊界。去到最後一星期,你應該可以將自己寫的 BSM/CRR/LSM 同 QuantLib 做 regression benchmark,再將同一個 strategy interface 放入自寫 backtester或者 LEAN。QuantLib 官方正正提供 pricing/risk framework,而 LEAN 官方 workflow 可以由 research/backtest 延伸至 live brokerage execution,所以兩者係很自然的後段工程參考。citeturn20search27turn22search6turn22search9

結論: 想一書到底,買 《Python for Finance, 2nd Edition》;想真正學好 options quant,再加 《Derivatives Analytics with Python》。中文閱讀優先就找後者的電子工業出版社譯本,但目前已較難買到新書。到完成上述十二星期項目後,再讀 Joshi/Duffy/QuantLib,先至最有價值——因為嗰時你面對的問題已經由「公式點寫」升級到「點設計一個可測試、可替換模型、可回測、可風控、可接 execution 的 derivatives system」。citeturn21view3turn8view0turn8view3turn20search8