Skip to content

ycytai/option-pricing-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages