@bmancini55/finance
Version:
Finance utilities for JavaScript
25 lines • 961 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.calcTimeValue = exports.calcIntrisicValue = void 0;
/**
* Calculates the intrinsic value of an option
* @param isCall true when option is call, false when option is put
* @param strike strike price of the option
* @param spot current spot price of underlying
*/
function calcIntrisicValue(isCall, strike, spot) {
return Math.max(0, isCall ? spot - strike : strike - spot);
}
exports.calcIntrisicValue = calcIntrisicValue;
/**
* Calculates the time value of an option
* @param isCall true when option is call, false when option is put
* @param option price of the option
* @param strike strike price of the option
* @param spot current spot price of underlying
*/
function calcTimeValue(isCall, option, strike, spot) {
return option - calcIntrisicValue(isCall, strike, spot);
}
exports.calcTimeValue = calcTimeValue;
//# sourceMappingURL=options-basic.js.map