PHP code example of shadiakiki1986 / blackscholes

1. Go to this page and download the library: Download shadiakiki1986/blackscholes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shadiakiki1986 / blackscholes example snippets




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

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