Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

shadiakiki1986/php-blackscholes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-blackscholes Build Status

Black-Scholes option pricing in php

Based on Black-Scholes in Multiple Languages and wikipedia formula

Installation

composer require shadiakiki1986/blackscholes

Usage

Example

Call option price example from quora

require_once 'vendor/autoload.php';

$strike = 470;
$interest = 0.02;
$timeToMaturity = 0.17;
$underlyingPrice = 460;
$volatility = 0.58;
$bs = new \shadiakiki1986\BlackScholes(
  $underlyingPrice,
  $strike,
  $timeToMaturity,
  $interest,
  $volatility
);
var_dump($bs->call());

will display 40.1047 (note that they have a mistake in their d1 function)

Alternatively

$call = new \shadiakiki1986\BlackScholesStatic::calculate(
  'c',
  $underlyingPrice,
  $strike,
  $timeToMaturity,
  $interest, 
  $volatility
);
var_dump($call);

About

php library to calculate black-scholes option prices

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages