1.0.1 • Published 2 years ago

stock-options-calculator v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

📉 Stock Options Calculator 📈

CI Known Vulnerabilities js-standard-style

Table of Contents

Install

npm i stock-options-calculator

Usage

Find break even point

Arguments

ArgumentTypeDescription
strikenumberstrike price ($$$ per share)
premiumnumber?current market price of an option ($$$ per share)
  • For call option

    Returns

    number - break-even price for call ($$$ per share)

    Example

    const { callBreakEvenPoint } = require('stock-options-calculator')
    
    callBreakEvenPoint(50) // returns 50
    callBreakEvenPoint(50, 10) // returns 60
  • For put option

    Returns

    number - break-even price for put ($$$ per share)

    Example

    const { putBreakEvenPoint } = require('stock-options-calculator')
    
    putBreakEvenPoint(50) // returns 50
    putBreakEvenPoint(50, 10) // returns 40

Count payoff

Arguments

ArgumentTypeDescription
strikenumberstrike price ($$$ per share)
stocknumberunderlying price ($$$ per share)
premiumnumber?current market price of an option ($$$ per share)
  • From buying call option

    Returns

    number - payoff from buying call ($$$ per share)

    Example

    const { payoffFromBuyingCall } = require('stock-options-calculator')
    
    payoffFromBuyingCall(50, 70) // returns 20
    payoffFromBuyingCall(50, 70, 10) // returns 10
  • From buying put option

    Returns

    number - payoff from buying put ($$$ per share)

    Example

    const { payoffFromBuyingPut } = require('stock-options-calculator')
    
    payoffFromSellingCall(50, 40) // returns 0
    payoffFromSellingCall(50, 40, 10) // returns 10
  • From selling call option

    Returns

    number - payoff from selling call ($$$ per share)

    Example

    const { payoffFromBuyingCall } = require('stock-options-calculator')
    
    payoffFromBuyingCall(50, 70) // returns 20
    payoffFromBuyingCall(50, 70, 10) // returns 10
  • From selling put option

    Returns

    number - payoff from selling put ($$$ per share)

    Example

    const { payoffFromSellingPut } = require('stock-options-calculator')
    
    payoffFromSellingPut(50, 40) // returns -10
    payoffFromSellingPut(50, 70, 10) // returns 10

Count price using Black-Scholes Model

Arguments

ArgumentTypeDescription
blackScholesInputObjectBlack-Scholes Model

blackScholesInput

ArgumentTypeDescription
strikenumberstrike price ($$$ per share)
stocknumberunderlying price ($$$ per share)
interestRatenumbercontinuously compounded risk-free interest rate (% p.a.)
volatilitynumberannual volatility (% p.a.)
timeToExpirenumbertime to expiration (% of year)
dividendnumber?continuously compounded dividend yield (% p.a.)
  • For call option

    Returns

    number - price for call ($$$ per share)

    Example

    const { callPrice } = require('stock-options-calculator')
    
    const strike = 58
    const stock = 60
    const interestRate = 0.035
    const volatility = 0.2
    const timeToExpire = 0.5
    const dividend: 0.0125  
    
    callPrice({ strike, stock, interestRate, volatility, timeToExpire }) // returns 5.0171
    callPrice({ strike, stock, interestRate, volatility, timeToExpire, dividend }) // returns 4.7704
  • For put option

    Returns

    number - price for putPrice ($$$ per share)

    Example

    const { putPrice } = require('stock-options-calculator')
    
    const strike = 58
    const stock = 60
    const interestRate = 0.035
    const volatility = 0.2
    const timeToExpire = 0.5
    const dividend: 0.0125  
    
    putPrice({ strike, stock, interestRate, volatility, timeToExpire }) // returns 2.0109
    putPrice({ strike, stock, interestRate, volatility, timeToExpire, dividend }) // returns 2.138

License

Stock Options Calculator is provided under the ISC License

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago