OptionPrice

OptionPrice ( IDataHolder strike , IDataHolder isPut , IDataHolder daysToExpiration , IDataHolder underlyingPrice , IDataHolder Volatility , double isEuropean , double yield , double interestRate );

Default values:

strike: getStrike() isPut: isPut() daysToExpiration: getDaysToExpiration() underlyingPrice: close(getUnderlyingSymbol()) Volatility: imp_volatility(getUnderlyingSymbol()) isEuropean: isEuropean() yield: getYield() interestRate: getInterestRate()

Description

Calculates the theoretical option price. By default, this function uses implied volatility averaged over different options for the underlying, so the returned result is approximate.

Input parameters

Parameter Default value Description
strike - Defines the strike price for the option.
isPut - Defines whether or not the current is Put.
daysToExpiration - Defines the number of days till the expiration of the option.
underlyingPrice close(getUnderlyingSymbol()) Defines the price of underlying symbol.
Volatility imp_volatility(getUnderlyingSymbol()) Defines the volatility with which the theoretical price is calculated.
isEuropean - Defines whether or not the oprion is European.
yield - Defines the yield of the underlying symbol for the option.
interestRate - Defines the global interest rate.

Example

input underlying = "GOOG";
input strike = 700.0;
input expiration_date = 20140118;
input is_put = no;
input interest_rate = 0.06;
input yield = 0.0;
input is_european = no;

def iv;
if GetAggregationPeriod() < AggregationPeriod.DAY {
iv = imp_volatility(underlying, AggregationPeriod.DAY);
} else {
iv = imp_volatility(underlying);
}

plot TheoOptPrice = OptionPrice(strike, is_put, DaysTillDate(expiration_date), close(underlying), iv, is_european, yield, interest_rate);

This script plots the theoretical price of Google January 2014 call option with $700 strike and interest rate of 6%.