BlackAndSchole - script and chart function
The Black and Scholes model is a mathematical model for financial market derivative instruments. The formula calculates the theoretical value of an option. In Qlik Sense, the BlackAndSchole function returns the value according to the Black and Scholes unmodified formula (European style options).
BlackAndSchole(strike , time_left , underlying_price , vol , risk_free_rate , type)
Return data type: numeric
|strike||The future purchase price of the stock.|
|time_left||The number of time periods remaining.|
|underlying_price||The current value of the stock.|
Volatility (of the stock price) expressed as a percentage in decimal form, per time period.
|risk_free_rate||The risk-free rate expressed as a percentage in decimal form, per time period.|
The type of option:
'c', 'call' or any non-zero numeric value for call options
'p', 'put' or 0 for put options.
The value of strike, time_left, and underlying_price must be >0.
The value of vol and risk_free_rate must be: <0 or >0.
BlackAndSchole(130, 4, 68.5, 0.4, 0.04, 'call')
This calculates the theoretical price of an option to buy a share that is worth 68.5 today, at a value of 130 in 4 years. The formula uses a volatility of 0.4 (40%) per year and a risk-free interest rate of 0.04 ( 4%).