kyos / options-calculator
A collection of methods to calculate option prices, greeks & implied volatilities
Installs: 146 655
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^7.4|^8.0|^8.1|^8.2|^8.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- pestphp/pest: ^1.15
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.8
This package is auto-updated.
Last update: 2024-12-05 11:36:27 UTC
README
Option Valuation Calculator
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.
Installation
You can install the package via composer:
composer require kyos/options-calculator
Usage
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
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.