Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.2 KB

README.md

File metadata and controls

59 lines (45 loc) · 1.2 KB

option-pricing-model

Aim to provide pricing models of European option.

Usage

Clone the project

git clone ...

Install packages

poetry shell
poetry install

Examples

from obj.base import Option
from pricing import (
    BlackScholesPricingModel,
    TrinomialTreePricingModel,
    BinominalTreePricingModel,
    MonteCarloPricingModel
)


option = Option(
    spot=42,
    strike=40,
    maturity=0.4,
    volatility=0.2,
    rate=0.1,
    yield_rate=0,
    option_type='C'
)


option.greeks
# output: {'delta': 0.7779, 'gamma': 0.056, 'theta': -4.815, 'vega': 7.9076, 'rho': 11.3526}

BlackScholesPricingModel.calculate(option=option)
# output: 4.2913

TrinomialTreePricingModel.calculate(option=option)
# output: 4.2908

BinominalTreePricingModel.calculate(option=option)
# output: 4.2893

MonteCarloPricingModel.calculate(option=option, mu=0.1)
# output: 4.5847