UNPKG

black-scholes-model

Version:

Complete plug and play Black-Scholes-Merton model for option pricing with features including implied volatility and Greeks.

20 lines 576 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cdf = void 0; const mathjs_1 = require("mathjs"); const cdf = ({ x, mean, vol }) => { if (!x) { throw new Error('Random variable cannot be empty'); } const u = mean || 0; const sig = vol || 1; if (sig === 0) { return x < u ? 0.0 : 1.0; } const denom = sig * Math.sqrt(2); const vc = x - u; const result = 0.5 * (1 + (0, mathjs_1.erf)(vc / denom)); return result; }; exports.cdf = cdf; //# sourceMappingURL=cdf.js.map