8.6.202-4.14.32 • Published 1 year ago

scholes v8.6.202-4.14.32

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Black Scholes

Black Scholes Algorithm in pure JS

Install

npm install scholes

Usage

// Using Require
const { blackScholes } = require("scholes");

// Using Import
// import { blackScholes } from "scholes";

const stockPrice = 100; // Current stock price
const strikePrice = 100; // Strike price
const time = 1; // Time to maturity in years
const rate = 0.05; // Risk-free interest rate
const volatility = 0.2; // Volatility

const callPrice = blackScholes({
  stockPrice,
  strikePrice,
  time,
  rate,
  volatility,
  optionType: "call",
});

console.log(callPrice === 10.450575415435083);