UNPKG

@volare.finance/volare.js

Version:
19 lines 781 B
"use strict"; /** * @file index.ts * @author astra <astra@volare.finance> * @date 2022 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.price = void 0; const MattL922_1 = require("../3rd-party/MattL922"); function price(vol, s, k, t, r, isPut, edge = 0.001) { const d1 = (Math.log(s / k) + (r + 0.5 * vol * vol) * t) / vol / Math.sqrt(t); const d2 = d1 - vol * Math.sqrt(t); const price = isPut ? Math.exp(-r * t) * k * (0, MattL922_1.stdNormCDF)(-d2) - s * (0, MattL922_1.stdNormCDF)(-d1) : s * (0, MattL922_1.stdNormCDF)(d1) - Math.exp(-r * t) * k * (0, MattL922_1.stdNormCDF)(d2); const bid = price * (1 - edge); const ask = price * (1 + edge); return [bid, ask]; } exports.price = price; //# sourceMappingURL=bs.price.js.map