Binomial Tree Option Pricing API
Binomial tree option pricing model implementation.
binomial_tree(option_type, underlying_price, strike_price, time_to_expiry, risk_free_rate, volatility, steps=100, dividend_yield=0.0)
Calculate option price using the binomial tree model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
option_type
|
str
|
Type of option ('european_call', 'european_put', 'american_call', 'american_put') |
required |
underlying_price
|
float
|
Current price of the underlying asset |
required |
strike_price
|
float
|
Strike price of the option |
required |
time_to_expiry
|
float
|
Time to expiration in years |
required |
risk_free_rate
|
float
|
Risk-free interest rate (annualized) |
required |
volatility
|
float
|
Volatility of the underlying asset (annualized) |
required |
steps
|
int
|
Number of time steps in the binomial tree, by default 100 |
100
|
dividend_yield
|
float
|
Continuous dividend yield, by default 0.0 |
0.0
|
Returns:
Type | Description |
---|---|
dict
|
Option price and details |
Raises:
Type | Description |
---|---|
ValueError
|
If option_type is not one of 'european_call', 'european_put', 'american_call', 'american_put' If underlying_price or strike_price is not positive If time_to_expiry is not positive If volatility is not positive If steps is not a positive integer |