shadiakiki1986/blackscholes

该包已被弃用且不再维护。未建议任何替代包。
此包的最新版本(0.0.2)没有提供许可证信息。

0.0.2 2017-01-06 08:55 UTC

This package is auto-updated.

Last update: 2020-01-26 16:40:40 UTC


README

PHP中的Black-Scholes期权定价

基于 多种语言的Black-Scholes维基百科公式

安装

composer require shadiakiki1986/blackscholes

使用

示例

来自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());

将显示 40.1047(注意他们d1函数中有一个错误)

或者

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