Pricing Engines
DerivFabric supports multiple pricing engines. The caller selects the engine via the pricer field in pricing requests.
Engine matrix
| Engine | ID | Vanilla | American | Exotic | Greeks |
|---|---|---|---|---|---|
| Analytical (BS) | 1 | Yes | No | Partial | Closed-form |
| Monte Carlo | 2 | Tree fallback | No | Yes | Bump-and-reprice |
| Finite Difference | 3 | Yes | Yes | No | Finite diff |
| Binomial Tree | 4 | Yes | Yes | No | Tree Greeks |
| Trinomial Tree | 5 | Yes | Yes | No | Tree Greeks |
| FFT (Carr-Madan) | 6 | Yes | No | No | Bump-and-reprice |
| LSM (Longstaff-Schwartz) | 7 | Yes | Yes | No | Pathwise |
| Barone-Adesi-Whaley | 8 | Yes | Yes | No | Bump-and-reprice |
Analytical pricers
| Pricer | Asset class | Instruments |
|---|---|---|
BlackScholesAnalyticalPricer | Equity | Vanilla European call/put |
BaroneAdesiWhaleyPricer | Equity | American call/put (quadratic approximation) |
BjerksundStenslandPricer | Equity | American call/put (alternative approximation) |
GeometricAsianPricer | Equity | Geometric-average Asian |
TurnbullWakemanPricer | Equity | Arithmetic-average Asian |
LevyAsianPricer | Equity | Arithmetic Asian (Levy) |
KemnaVorstPricer | Equity | Geometric Asian (Kemna-Vorst) |
ConzeViswanathanPricer | Equity | Lookback (floating/fixed strike) |
GoldmanSosinGattoPricer | Equity | Lookback (alternative) |
IkedaKunitomoPricer | Equity | Single/double barrier |
KirkPricer | Equity | Spread options |
VannaVolgaPricer | FX | Vanna-Volga method |
CDSBlackPricer | Credit | CDS options |
Monte Carlo
- GBM paths for European exotics and DSL contracts
- LSM (Longstaff-Schwartz) for American options with configurable basis functions (Laguerre, Hermite, Chebyshev, Monomials)
- Multi-asset correlated paths via Cholesky decomposition for basket/worst-of products
- Antithetic variance reduction supported
FFT
Carr-Madan FFT pricing with pluggable characteristic functions:
- Heston stochastic volatility
- Merton jump-diffusion
- Bates (stochastic vol + jumps)
Contract DSL pricing
The DSL evaluator compiles contracts to payoff functions and prices via Monte Carlo:
Contract → ContractEvaluator::compile() → Box<dyn Fn(&[f64]) -> f64>
→ Generate GBM paths
→ Evaluate payoff on each path
→ Discount average payoff