计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
matlab-price-instrument【效率与协作】Price financial instruments in MATLAB using the Financial Instruments Toolbox. Route to the appropriate numerical method reference based on the user's request: Monte Carlo simulation (AssetMonteCarlo, IRMonteCarlo, RoughVolMonteCarlo), FFT / Numerical Integration (Vanilla European options), or Interest-Rate Trees (option-embedded bonds with IRTree). …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Price financial instruments in MATLAB using the Financial Instruments Toolbox. Route to the correct numerical pricing method based on the user's request, then follow the method-specific reference for implementation details.
Identify the pricing method from the user's request and read the corresponding reference:
| Method | Reference | When to Use |
|---|---|---|
| Monte Carlo (MC) | references/monte-carlo.md | Simulation-based pricing: path-dependent options, exotic options, Interest Rate (IR) derivatives via MC, rough volatility |
| FFT / FRFT / Numerical Integration | references/ni-fft.md | Fast pricing: European vanilla options under Heston/Bates/Merton via characteristic functions |
| Interest Rate Trees | references/embedded-bond-tree.md | Callable/puttable fixed-rate bonds with Hull-White (HW), Black-Karasinski (BK), Black-Derman-Toy (BDT), Cox-Ingersoll-Ross (CIR) tree models |
Read exactly one reference (and any relevant sub-references) that best matches based on these rules:
User mentions a specific pricer:
AssetMonteCarlo, RoughVolMonteCarlo, IRMonteCarlo -> references/monte-carlo.mdFFT, NumericalIntegration -> references/ni-fft.mdIRTree -> references/embedded-bond-tree.mdUser mentions a specific numerical method and associated concepts:
references/monte-carlo.mdreferences/ni-fft.mdreferences/embedded-bond-tree.mdUser mentions instrument type without a method:
references/monte-carlo.mdreferences/ni-fft.mdreferences/embedded-bond-tree.mdreferences/monte-carlo.mdUser mentions model name without a method:
references/ni-fft.mdreferences/monte-carlo.mdreferences/embedded-bond-tree.mdreferences/monte-carlo.mdreferences/monte-carlo.mdAmbiguous:
references/ni-fft.md (faster, more accurate for European vanilla)references/monte-carlo.mdreferences/embedded-bond-tree.mdAll three methods share these conventions:
finpricer/fininstrument/finmodel/ratecurve objects (modern OO API) over legacy functions"DiscountCurve", not positional argumentsdatetime for dates (not datenum)price as a variable name — it shadows the price function; prefer p, or capitalized Priceprice() when Greeks or tree data are needed: [p, pr] = price(...)Best practice: Check MATLAB documentation (doc <functionName>, or help <functionName>, etc.) via the MATLAB MCP server before writing code.
| Mistake | Correct |
|---|---|
finpricer("MonteCarlo", ...) | finpricer("AssetMonteCarlo", ...) or finpricer("IRMonteCarlo", ...) |
finpricer("HWMonteCarlo", ...) | finpricer("IRMonteCarlo", ...) with a HullWhite model |
| Mixing pricer families (e.g., FFT pricer for Asian option) | FFT/NI only works for European vanilla; use AssetMonteCarlo for exotics |
Using datenum | Always use datetime |
| Forgetting second output for Greeks | [p, pr] = price(pricer, inst, "delta") — Greeks are in pr.Results |
discount(rc, dates) | discountfactors(rc, dates) — ratecurve uses discountfactors(), not discount() |
Copyright 2026 The MathWorks, Inc.