Tag Archives: Black-Scholes

Visualizing Volatility Sensitivity in Delta hedged gains with TI Nspire

The TI Nspire calculator is a great platform for visualizing data via interactive graphs. The built-in facility like input slider for variable value adjustment allowed dynamic visualization to complex equations, like the volatility sensitivity in delta-hedged gains used financial investment. Since this strategy involved a single call option, the volatility exposure equals the vega value of the option.

The following setup on the Nspire provided the functions to calculate the vega values.
vega1

This spreadsheet input screen stores the spot prices and the calculated Black Scholes vega values.
vega2

Finally, with the data plotting screen the graph of Delta hedged gains of volatility sensitivity is completed. An additional slider control can easily be added on it to adjust an offset variable so as to visualize scenarios under different spot price.
vega3

Advertisements

Black-Scholes formula in TI-84 Solver

Came across a ten-year old article from TI on working with the Black-Scholes pricing model in TI-84. In it, a couple of examples are given to utilize various features of the TI-84 to work with the equation to derive an European call option in the Black-Scholes model. One of these method being invoking the Solver.

Entering the equation again is considered quite cumbersome, and it is not quite sure how to archive the Solver equation for later use. After a couple of tries, it become obvious that the Solver wouldn’t work with a function stored in String at all. Fortunately alternative method is found to somehow persist the equation for later use.

The trick is to make use of the following build-in functions available in the TI-84:

  • String>Equ()
  • expr()

By making use of these two functions, the Solver will be able to handle the Black-Scholes equation which is stored in String properly. Firstly the equation must be stored in a String, and then by making use of String>Equ() function, the equation will be able to persist in one of the equation variables. In this form, the Solver will be happy to work with it in its entirety, which means all variables are considered. The equation stored in Str0 is converted to function Y0, and is then processed properly by the Solver as shown in the below screens. For persisting, this can be done in a program including the definition of the Black-Scholes formula itself.

Extracting Black-Scholes implied volatility in Nspire

The Black-Scholes model is an important pricing model for options. In its formula for European call option, the following parameters are required to create a function in the TI Nspire CX:

  • s – spot price
  • k – strike price
  • r – annual risk free interest rate
  • q – dividend yield
  • t – time to maturity
  • v – volatility

blackscholes-newton4

Now that the standard Black-Scholes formula is ready, a common method to derive the implied volatility numerically is to determine a value such that the squared loss function between observed price and calculated Black-Scholes price is zero. To derive this volatility, root finding method like the Newton-Raphson method can easily be implemented with advanced calculators like the TI Nspire. In fact, there is no need to code this feature by utilizing the built-in zeros() function of the CX CAS. This function solve for the selected variable from the input expression so that the result is zero, which is exactly what is needed in this case. The function implied_vola() below is coded to do the squared loss function, which is then passed into the CAS built-in zeros() function. Notice a warning of “Questionable accuracy” is reported for the zeros() function.

blackscholes-newton2

Doing the Newton-Raphson method is simple enough with the Nspire Program Editor. The program below bs_call_vnewtrap() takes a list of Black-Scholes parameters (including the s,k,r,q,t,v), an initial guess value of implied volatility, and the call price of the standard Black-Scholes formula. The last parameter is a precision control (value of zero default to a pre-set value). The last two attempts calling this function shown below depicts the effect of the precision control in this custom root-finding program.blackscholes-newton1

blackscholes-newton3