JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q41018F
  • License MIT

Package Exports

  • scholes
  • scholes/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scholes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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);