abaquant.derivatives.monte_carlo¶
Import path: abaquant.derivatives.monte_carlo
Domain: Derivative pricing, simulation, calibration, diagnostics, and strategy analysis.
Purpose¶
Monte Carlo Black–Scholes–Merton option valuation.
When to use it¶
Use this package when valuing contingent claims, calculating Greeks, building option strategies, simulating stochastic processes, or fitting models to market observations.
Public objects¶
function:
monte_carlo_bsm— Estimate a European option value with Black–Scholes–Merton simulation.
Detailed reference¶
Monte Carlo Black–Scholes–Merton option valuation.
Purpose¶
The module simulates lognormal terminal prices and estimates European option values with optional variance-reduction techniques.
Conventions¶
Maturity is in years; rates, yields, and volatility are decimal annual values; n_paths is the number of simulated paths.
References
[ 1 ] Glasserman, P. (2004), Monte Carlo Methods in Financial Mathematics. [ 2 ] Black, F., and M. Scholes (1973), “The Pricing of Options and Corporate Liabilities”; Merton, R. C. (1973), “Theory of Rational Option Pricing”.
- abaquant.derivatives.monte_carlo.monte_carlo_bsm(S, K, T, r, sigma, q=0.0, option_type='call', n_paths=50_000, seed=42, antithetic=True, control_variate=True)¶
Estimate a European option value with Black–Scholes–Merton simulation.
- Parameters:
S (float) – Legacy formula notation for the current spot price. New class-based workflows expose this input as
spot_price.K (float) – Legacy formula notation for the option strike price.
T (float) – Legacy formula notation for maturity in years.
r (float) – Legacy formula notation for the continuously compounded annual risk-free rate in decimal units.
sigma (float) – Legacy formula notation for annualized lognormal volatility in decimal units; for example,
0.20denotes 20% annualized volatility.q (float, default=0.0) – Continuous annual dividend or carry yield in decimal units.
option_type ({"call", "put"}, default="call") – Option payoff to simulate.
n_paths (int, default=50000) – Requested number of terminal-price paths. With antithetic variates, the effective path count equals the generated draw count.
seed (int or None, default=42) – Seed passed to NumPy’s random-number generator. Use
Nonefor a non-reproducible stream.antithetic (bool, default=True) – Whether each standard-normal draw is paired with its negative.
control_variate (bool, default=True) – Whether discounted terminal underlying value is used as a control variate with known expectation
S * exp(-q * T).
- Returns:
Dictionary with these fields:
"price": Monte Carlo option-value estimate."std_error": estimated standard error of the final estimator."ci_95_lo"and"ci_95_hi": normal-approximation 95% confidence interval."n_paths": requested simulation path count."bsm_price": analytical Black–Scholes–Merton benchmark."error_vs_bsm": absolute difference from that benchmark.
- Return type:
dict[str, float | int]
Notes
The routine simulates only terminal prices and therefore values European payoffs. It does not support path-dependent or early-exercise features. The short public parameter names are retained for formula familiarity and backward compatibility; all internal state uses descriptive identifiers.
References
Glasserman, P. (2004). Monte Carlo Methods in Financial Mathematics.