A collection of methods to calculate option prices, greeks & implied volatilities.
Range of supported products:
- European options on futures, using the Black'76 methodology.
Range of supported methodologies to derive implied volatilities:
- Bisection search algorithm.
You can install the package via composer:
composer require kyos/options-calculator
use Kyos\OptionsCalculator\Black76;
$bs = new Black76();
echo $bs->getValues(Black76::CALL, 10.5, 12, 0.082, 0.60);
// [
// 'value' => 0.2405826183655344,
// 'delta' => 0.24449431791580983,
// 'gamma' => 0.17399585222314845,
// 'vega' => 0.009438057012140243,
// 'theta' => -3.450541861184725,
// 'rho' => -0.00019727774705973822,
// ]
echo $bs->getValues(Black76::PUT, 10.5, 12, 0.082, 0.60);
// [
// 'value' => 1.7393531225277215,
// 'delta' => -0.7546860181923143,
// 'gamma' => 0.17399585222314845,
// 'vega' => 0.009438057012140243,
// 'theta' => -3.435554156143103,
// 'rho' => -0.0014262695604727318,
// ]
echo $bs->getImpliedVolatility(Black76::CALL, 10.5, 12, 0.082, 0.2405826183655344);
// 0.60
echo $bs->getImpliedVolatility(Black76::PUT, 10.5, 12, 0.082, 1.7393531225277215);
// 0.60
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.