IFRS Technical Note

Design and Implementation of a Segmented Lattice-Based Model for the Valuation of Employee Stock Option Plans (ESOP) under IFRS 2: Share-Based Payment

Paul McAteer, MSc, MBA

pcm353@stern.nyu.edu


Contents

  • 1. Summary of the Guidance on Valuation Principles in the Standard
  • 2. Interpretation of the Guidance
  • 3.1. Basic Model Overview
  • 3.2. Basic Model Design: Inputs for the Binomial Tree (Cox, Ross, and Rubinstein) method to value ESOP as long-dated American Option
  • 3.3. Basic Model Design: Solved Parameters for Binomial Tree
  • 4. Intermediate Model Design
  • 5. Final Model Design
  • 6.1. Basic Model Construction
  • 6.2. Basic Model Implementation
  • 6.3. Basic Model Output
    • 6.3.1. Basic Model Output: Visualization of Tree as Lattice
    • 6.3.2. Basic Model Output: Visualization of Tree as List
  • 7.1. Intermediate Model Construction
  • 7.2. Intermediate Model Implementation and Output
  • 8.1. Final Model Construction
  • 8.2. Final Model Implementation
  • 8.3. Final Model Output: Summary
  • 8.4. Final Model Output: Tree Visualization
  • 8.5. Final Model Output: Model Performance
  • 8.6. Final Model Output: Sensitivity Analysis and Cost Evaluation
    • 8.6.1. Final Model Output: Single-Factor Sensitivity Analysis
    • 8.6.2. Final Model Output: Dual-Factor Sensitivity Analysis

1. Summary of the Guidance on Valuation Principles in the Standard

IFRS 2.1 explicitly defines the objective of the Standard as the specification of the “expenses associated with transactions in which share options are granted to employees”. IFRS 2.2 requires the expensing of “equity-settled share-based payment transactions, in which the entity receives…services as consideration for equity instruments of the entity (including shares or share options)”. IFRS 2.10 requires the determination and recognition of “fair value” of this expense: “For equity-settled share-based payment transactions, the entity shall measure…the fair value of the…services received”. IFRS 2.11 provides further clarification on the definition of “fair value” : “To apply the requirements of paragraph 10 to transactions with employees and others providing similar services, the entity shall granted…The fair value of those equity instruments shall be measured at grant date.”

An option-pricing approach to the assignment of fair value is stipulated in IFRS 2.33: “The liability shall be measured, initially and at each reporting date until settled, at the fair value of the share appreciation rights, by applying an option pricing model, taking into account the terms and conditions on which the share appreciation rights were granted, and the extent to which the employees have rendered service to date.”

The Standard is not prescriptive regarding which valuation models should be used though it does describe the factors that should be taken into account when estimating the fair value. In IFRS 2.47, detailing disclosure requirement, assumes that “inputs to the model” will comprise at least “the weighted average share price, exercise price, expected volatility, option life, expected dividends, the risk-free interest rate…the method used and the assumptions made to incorporate the effects of expected early exercise”.

Appendix B offers more insight into the suitability or otherwise of certain models. IFRS 2 B.5 notes that the Black-Scholes-Merton may prove insufficiently flexible: “[M]any employee options have long lives, are usually exercisable during the period between vesting date and the end of the options’ life, and are often exercised early. These factors should be considered when estimating the grant date fair value of the options. For many entities, this might preclude the use of the Black-Scholes-Merton formula, which does not allow for the possibility of exercise before the end of the option’s life and may not adequately reflect the effects of expected early exercise. It also does not allow for the possibility that expected volatility and other model inputs might vary over the option’s life.” IFRS 2 B.17 highlights the advantages of a more flexible lattice-based model: “[E]xpected early exercise could be modelled in a binomial or similar option pricing model that uses contractual life as an input”.

2. Interpretation of the Guidance

The model framework should be sufficiently flexible to account for:

  1. Exercise prior to expiration.
  2. Required vesting period during which exercise is prohibited.
  3. Option rights forfeiture due to employee exit during and after vesting period.
  4. Time-varying volatility.

The restrictiveness of the assumptions inherent in Black-Scholes-Merton option pricing model mean that it is generally unsuitable for valuing Employee Stock Option Plans (ESOP). Moreover, the failure to account for employee behaviour and volatility of volatility in the application of BSM could lead to inaccurately high or low option values.

3.1. Basic Model Overview

If we begin by allowing for early exercise, and the non-constant volatility and dividend payments of the underlying whilst ignoring the existence of a vesting period and the possibility of option rights forfeiture, one can view the ESOP as a long-dated American-style call option granted by the Company to the employees. Traditional closed-form analytical1 or Monte-Carlo simulation2 solutions fail to incorporate the possibility of early exercise. Lattice-based models are a favoured approach to value those path-dependent options such as American options, where the timing of exercise is at the holder’s discretion. We refer to the binomial model for valuing American Options as the Basic Model, which we employ for largely pedagogical purposes en route to building the Final Model.




1 A 2008 paper gives an analytical derivation of the value of employee stock options. The formula stretches over 16 pages of typescript. Due to its complexity, the approach has failed to supplant binomial models as the preferred approach for ESO valuation. See Cvitanić, Jakša, Z. Wiener and F. Zapatero. “Analytic Pricing of Employee Stock Options.” Review of Financial Studies 21 (2008): 683-724.
2 A 2001 paper by Longstaff & Schwartz presents a new approach for approximating the value of American options by simulation. To date the model has not been adapted to incorporate the more complex characteristics particular to Employee Stock Option Plans. See Longstaff, Francis & Schwartz, Eduardo. (2001). Valuing American Options by Simulation: A Simple Least-Squares Approach. Review of Financial Studies. 14. 113-47.

3.2. Basic Model Design: Inputs for the Binomial Tree (Cox, Ross, and Rubinstein) method to value ESOP as long-dated American Option

Model Inputs For CRR Model3


Variable Notation Description Value
Stock S Underlying asset. Stock price of the Sponsoring Company €100
Strike Price K The price at which option holders can exercise the right to buy the underlying. The difference between stock and strike is the intrinsic value (IV). IV is floored at zero as rational actors will only exercise if S>K €115
Volatility σ The volatility of the underlying. An input in the Binomial model which determines the magnitude of the up and down moves. May be based on historic or implied volatility. 30%
Timestep Δt The fractions of time into which the Tree is segmented from the initial node at to to terminal nodes at tN . 50
Time to Expiry T Time in years to maturity of option. 10
Risk Free Rate r The riskless interest rate. An important input to computing risk neutral probabilities 5%
Dividend Yield q The dividend yield on the underlying. Also an important input to computing risk neutral probabilities 2.5%



3 Cox, J., S. Ross, and M. Rubinstein (1979): “Option Pricing: A Simplified Approach.” Journal of Financial Economics, Volume 7, Issue 3, pp. 229–263

3.3. Basic Model Design: Solved Parameters for Binomial Tree

The probability of reaching a particular node in the binomial tree depends on the numbers of distinct paths to that node and the probabilities of the up and down moves.
The binomial grid of 4 time steps below shows all asset price paths to each node. "u" represents an up-move and "d" a down-move.

The probability of reaching a particular node in the binomial tree depends on the numbers of distinct paths to that node and the probabilities of the up and down moves. The tree below displays the probability of reaching each node. "p" denotes the probability of an up-move and 1-p the probability of a down-move.

Derivation of Parameters


Recall that the binomial tree model is formed by building forward the “tree” of interim and terminal asset prices then performing backward induction, which values the option at each node as the probability-adjusted, discounted value of its child nodes. The option price is the sum of these discounted expected values.

The underlying asset price path is determined by the number of time steps and the magnitude of “up-moves” and “down-moves” at each node.

The magnitude of these moves is an exponential function of volatility scaled by square root of time:

UP-MOVE:
u=eσΔt

DOWN-MOVE:
d=1u=eσΔt

Risk neutral valuation allows us to infer the probability of an “up-move”. Risk neutral probabilities are the implied probabilities, which equate the current market price of the option to the discounted expected payoff. They are the outputs of a function which takes the market value, future expected value and the discount rate as the inputs. The fundamental assumption is that the call option seller can form a riskless portfolio by going long a fraction of the share - determined by delta - and writing a call option (f):

S0Δf

The payoff at each up and down node - the sum of (delta*stock) PLUS the intrinsic value of option - will be the same.


S0uΔfu= S0dΔfd

Delta is the fraction which equates the payoff at up and down nodes.

Δ = fufdS0u S0d

The seller of the option has delta hedged his exposure. The portfolio is riskless and, for there to be no arbitrage opportunities, it must earn the risk-free interest rate. The payoff at each node - the future portfolio value, composed of option and fraction of share - is discounted to the present value at the risk-free rate:

S0Δf= (S0uΔfu)erΔt

Rearranging, we find the option value at each node to be the discounted value of the fractional share position and the discounted intrinsic value of the option:

f= S0Δ (1uerΔt)+fuerΔt

Or, equivalently:

f= S0fufdS0u S0d (1uerΔt)+fuerΔt

Which, upon removing the S0 terms, simplifies to:

f= fu(1derΔt)+fd(uerΔt1)ud

Which can be expressed in terms of a risk neutral probability:

f= erΔt[fup+ fd(1p) ] 

Where:

RISK-NEUTRAL PROBABILITY OF UP-MOVE, p:
p= erΔtdud

4. Intermediate Model Design

The Financial Accounting Standards Board4 proposed a two-step adjustment procedure to the classic American Binomial Model in order to better reflect early exercise and option rights forfeiture.

  • Firstly, the options’ contractual life (T) should be substituted for their expected life (L) when constructing the binomial American option pricing model. The expected life is the weighted average of expected time to exercise of plan participants.
  • Secondly, the (annually compounded) exit rate (w) over the vesting period (v) should be estimated.

We can represent the adjusted price of an American Options by the so-called FASB 123 method in a simple formula:

fFASB123= fAmericanL=T  × (1w)v



4 Financial Accounting Standards Board. 1995. FASB 123: Accounting for Stock-Based Compensation. Appendix B

5. Final Model Design

In their 2004 paper5, Hull and White made a number of criticisms of the FASB 123 model.

  • Firstly, they noted that that the feature of the inability to exercise options during the vesting period is not incorporated. The binomial tree model assumes exercise at any time until the end of the expected life.
  • Secondly, they contend that early exercise behaviour should be a function of the magnitude of the intrinsic value. More specifically, they model the early exercise behaviour of employees by assuming that exercise takes place whenever the stock price reaches a certain multiple (M) of the strike price and the option has vested. This assumption is grounded in the cited research of Huddart and Lang (1996)6 and Carpenter(1998)7 which indicates that the the average value for M should be between 2.2 and 2.8.
  • Finally, they argue that the employee exit rate both before and after the vesting period should be explicitly considered.

  • The Hull-White Enhanced model, segments the Binomial Tree into 4 regions:


    REGION 1: At the terminal nodes of a tree comprising N time steps, the value of the option is the option’s intrinsic value:

    fN,j=  Max [  SN,jK , 0   ] 


    REGION 2: During the vesting period (v), the option prices at the at the jth node of the tree at time iΔt (where iΔt < v) are computed as:

    fi,j= ewΔt erΔt[p fi+1,j+1 + (1p) fi+1,j ]

    Note the similarity to pricing of a European style option within a Binomial model framework.


    REGION 3: After the vesting period (where iΔt V), if the stock price is greater than or equal to the exercise criterion (Si,jK M,) then the option will be exercised:

    fi,j=  Max [  Si,jK , 0   ] 


    REGION 4: After the vesting period (where iΔt v), if the stock price is less than the exercise criterion, (Si,j <K M,), then the option will be held:

    fi,j=( 1ewΔt) Max[  Si,jK , 0   ] + ewΔt erΔt[p fi+1,j+1 + (1p) fi+1,j ]

    Note the effect of weighting achieved with the combination of the ( 1ewΔt) and ewΔt terms.


    We can visualize this model in the following image which preserves the original notation of the Hull White 2004 paper.
    𝑒𝑟δ𝑡 denotes a continuous discount factor whereas 𝑒𝛿𝑡 denotes the product of the exit rate and the time step interval.The double use of e to denote both exponential and exit rate tends to confuse for which reason I opt for less ambiguous notation above.

HW%20MODEL.PNG




5 Hull, J, and White, A: How to Value Employee Stock Options Financial Analysts Journal, Vol. 60, No. 1, January/February 2004, 114-119
6 Huddart S, Lang M (1996) Employee stock option exercises: an empirical analysis. J Account Econ 21:5–43
7 Carpenter JN (1998) The exercise and valuation of executive stock options. J Financ Econ 48:127–158

6.1. Basic Model Construction

In [1]:
import numpy as np


def Binomial(n, S, K, r,q, v, t, PutCall):  

    # Solved Parameters

    At = t/n                                #Timestep

    u = np.exp(v*np.sqrt(At))               # Upmove

    d = 1./u                                # Downmove

    p = (np.exp((r-q)*At)-d) / (u-d)         # Risk-Neutral Probability



    #Binomial price tree

    stockvalue = np.zeros((n+1,n+1))                #Create symmetrical zero-filled array with dimensions of Timesteps + 1

    stockvalue[0,0] = S                             #Location of current stock price in matrix (1st element in 1st column)
                                                    # Note the rows express time progression and columns tree level
    
    for i in range(1,n+1):                          #Outer loop: For each timestep...

        stockvalue[i,0] = stockvalue[i-1,0]*u       # Compute future stockprice as product of prev. price and upmoves

        for j in range(1,i+1):                      # Inner Loop: For each time step at each tree level...
            
            stockvalue[i,j] = stockvalue[i-1,j-1]*d # Compute associated downmove stock value for each upmove
                                                    # (Nested for loop."Inner loop" will be executed one time 
                                                    # for each iteration of the "outer loop").
                                                     
             

    #Option value at terminal nodes   

    optionvalue = np.zeros((n+1,n+1))               #Create symmetrical zero-filled matrix with dimensions of Timesteps + 1

    for j in range(n+1):                            # For each node at the terminal time step...
                                                    # Compute instrinsic value based on put or call position
        if PutCall=="C": # Call

            optionvalue[n,j] = max(0, stockvalue[n,j]-K)      

        elif PutCall=="P": #Put

            optionvalue[n,j] = max(0, K-stockvalue[n,j])

    

    #Backward induction process for option values at interim nodes    

    for i in range(n-1,-1,-1):                    # For each time step, working backwards, from penultimate to first...

        for j in range(i+1):                      # For each node at each of above time step...
                                                  # Compute the maximum of the expected value and the current intrinsic val.

                if PutCall=="P":                 

                    optionvalue[i,j] = max(0, 
                                           K-stockvalue[i,j],np.exp(-r*At)*(p*optionvalue[i+1,j]+(1-p)*optionvalue[i+1,j+1]))

                elif PutCall=="C":

                    optionvalue[i,j] = max(0, 
                                           stockvalue[i,j]-K,np.exp(-r*At)*(p*optionvalue[i+1,j]+(1-p)*optionvalue[i+1,j+1]))
    


    #return optionvalue[0,0]
    return optionvalue[0,0], stockvalue, optionvalue, n, S, K, r, q, v,t
    

6.2. Basic Model Implementation

In [2]:
from tabulate import tabulate

# Inputs

n = 25        #number of steps

S = 100      #initial underlying asset price

r = 0.05     #risk-free interest rate

q = 0.025     #risk-free interest rate

K = 115      #strike price

v = 0.3      #volatility

t = 10      #time to expiry


result = Binomial(n, S, K, r, q, v, t, PutCall="C")


header3 = ['Opt. Val.(Basic Model)','Spot', 'Strike', 'Rfr','Div. Yld.', 'Vol.',
           'Time to Exp.', 'Time Steps']
table3 = [[result[0], result[4],result[5],result[6],result[7],result[8],result[9],result[3]]]

print(tabulate(table3,header3))
  Opt. Val.(Basic Model)    Spot    Strike    Rfr    Div. Yld.    Vol.    Time to Exp.    Time Steps
------------------------  ------  --------  -----  -----------  ------  --------------  ------------
                 32.2921     100       115   0.05        0.025     0.3              10            25

6.3. Basic Model Output

6.3.1. Basic Model Output: Visualization of Tree as Lattice

As we shall in our extended discussion of the Final Model, the optimal number of tree steps, in terms of computational expense versus results accuracy/convergence, is around 2000. It is impractical to view node results as a tree when the time steps exceed 25-30, as can be apreciated below. It is therefore more instructive to shift to generating node values in the form of list.

In [3]:
# Import required libraries
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx


# Plot Binomial Grid
def binomial_grid(n):

    G=nx.Graph()                                    # Empty Grid
    for i in range(0,n+1):                          # Outer Loop: For each time fraction of time Initial to Terminal
        for j in range(1,i+2):                      # Inner Loop: For each node at each time step first to final
            if i<n:                                 # Add connectors between all pre-terminal nodes 
                G.add_edge((i,j),(i+1,j))
                G.add_edge((i,j),(i+1,j+1))
    posG={}                                         # Situate Nodes
    for node in G.nodes():
        posG[node]=(node[0],n+2+node[0]-2*node[1])
    
    nx.draw(G,pos=posG)

# Plot Price and Option Tree
def plot_binomial_tree(initial_spot, asset_array, option_array):

    s = initial_spot
    px = asset_array
    opx = option_array

    
    # displaying the title 
    
    plt.figure(figsize=(14, 12))
    plt.suptitle('Binomial Tree: 30 Time Steps', fontsize=20)

    # Start
    plt.figtext(-0.07,0.50, 'S = '+str(s))
    plt.figtext(-0.07,0.47, 'V = '+"{:.2f}".format(opx[0,0]))


    binomial_grid(25)
In [4]:
px = result[1]
opx = result[2]

# Plot a 30-Step Binomial Tree 
# displaying the title

plot_binomial_tree(px[0,0], px, opx)

6.3.2. Basic Model Output: Visualization of Tree as List

The tree nodes are represented as coordinates with first co-oordinate as time step and the second as first node level. So, for example, the co-oordinates [1,1] and [1,0] refer to the the up and down moves in the first step pf the binomial tree. The following code generates this "Co-ordinate Dictionary" to hold these values.

.

In [5]:
# Tree Visualization
    
    # Create empty dictionaries to hold all node values at all time steps
    S_vals = {} 
    O_vals = {}
    
    # Assigns keys and values to S_Vals dictionary
    for j in range(0, n+1): 

            S_vals[(n, j)] = round(px[n,j], 3)                 #Terminal Stock Values
    
    for i in range(n-1,-1,-1):
        
        for j in range(i+1):
            
            S_vals[(i, j)] = round(px[i,j],3)                 #Interim Stock Values 

    # Assigns keys and values to O_Vals dictionary
    for j in range(0, n+1): 

            O_vals[(n, j)] = round(opx[n,j], 3)                 #Terminal Option Values
    
    for i in range(n-1,-1,-1):
        
        for j in range(i+1):
            
            O_vals[(i, j)] = round(opx[i,j],3)                 #Interim Option Values 
In [6]:
for (i, j), value in S_vals.items():
    print(f" At Node [{i:<3}, {i-j:<2}]    The stock value is: {value:>15}")
 At Node [25 , 25]    The stock value is:       11482.583
 At Node [25 , 24]    The stock value is:        7856.632
 At Node [25 , 23]    The stock value is:        5375.678
 At Node [25 , 22]    The stock value is:        3678.156
 At Node [25 , 21]    The stock value is:        2516.674
 At Node [25 , 20]    The stock value is:        1721.963
 At Node [25 , 19]    The stock value is:        1178.204
 At Node [25 , 18]    The stock value is:         806.153
 At Node [25 , 17]    The stock value is:         551.587
 At Node [25 , 16]    The stock value is:         377.408
 At Node [25 , 15]    The stock value is:         258.231
 At Node [25 , 14]    The stock value is:         176.687
 At Node [25 , 13]    The stock value is:         120.893
 At Node [25 , 12]    The stock value is:          82.718
 At Node [25 , 11]    The stock value is:          56.597
 At Node [25 , 10]    The stock value is:          38.725
 At Node [25 , 9 ]    The stock value is:          26.497
 At Node [25 , 8 ]    The stock value is:          18.129
 At Node [25 , 7 ]    The stock value is:          12.405
 At Node [25 , 6 ]    The stock value is:           8.487
 At Node [25 , 5 ]    The stock value is:           5.807
 At Node [25 , 4 ]    The stock value is:           3.973
 At Node [25 , 3 ]    The stock value is:           2.719
 At Node [25 , 2 ]    The stock value is:            1.86
 At Node [25 , 1 ]    The stock value is:           1.273
 At Node [25 , 0 ]    The stock value is:           0.871
 At Node [24 , 24]    The stock value is:        9498.128
 At Node [24 , 23]    The stock value is:        6498.825
 At Node [24 , 22]    The stock value is:        4446.637
 At Node [24 , 21]    The stock value is:        3042.485
 At Node [24 , 20]    The stock value is:        2081.735
 At Node [24 , 19]    The stock value is:        1424.368
 At Node [24 , 18]    The stock value is:         974.583
 At Node [24 , 17]    The stock value is:         666.831
 At Node [24 , 16]    The stock value is:          456.26
 At Node [24 , 15]    The stock value is:         312.183
 At Node [24 , 14]    The stock value is:         213.603
 At Node [24 , 13]    The stock value is:         146.151
 At Node [24 , 12]    The stock value is:           100.0
 At Node [24 , 11]    The stock value is:          68.422
 At Node [24 , 10]    The stock value is:          46.816
 At Node [24 , 9 ]    The stock value is:          32.032
 At Node [24 , 8 ]    The stock value is:          21.917
 At Node [24 , 7 ]    The stock value is:          14.996
 At Node [24 , 6 ]    The stock value is:          10.261
 At Node [24 , 5 ]    The stock value is:           7.021
 At Node [24 , 4 ]    The stock value is:           4.804
 At Node [24 , 3 ]    The stock value is:           3.287
 At Node [24 , 2 ]    The stock value is:           2.249
 At Node [24 , 1 ]    The stock value is:           1.539
 At Node [24 , 0 ]    The stock value is:           1.053
 At Node [23 , 23]    The stock value is:        7856.632
 At Node [23 , 22]    The stock value is:        5375.678
 At Node [23 , 21]    The stock value is:        3678.156
 At Node [23 , 20]    The stock value is:        2516.674
 At Node [23 , 19]    The stock value is:        1721.963
 At Node [23 , 18]    The stock value is:        1178.204
 At Node [23 , 17]    The stock value is:         806.153
 At Node [23 , 16]    The stock value is:         551.587
 At Node [23 , 15]    The stock value is:         377.408
 At Node [23 , 14]    The stock value is:         258.231
 At Node [23 , 13]    The stock value is:         176.687
 At Node [23 , 12]    The stock value is:         120.893
 At Node [23 , 11]    The stock value is:          82.718
 At Node [23 , 10]    The stock value is:          56.597
 At Node [23 , 9 ]    The stock value is:          38.725
 At Node [23 , 8 ]    The stock value is:          26.497
 At Node [23 , 7 ]    The stock value is:          18.129
 At Node [23 , 6 ]    The stock value is:          12.405
 At Node [23 , 5 ]    The stock value is:           8.487
 At Node [23 , 4 ]    The stock value is:           5.807
 At Node [23 , 3 ]    The stock value is:           3.973
 At Node [23 , 2 ]    The stock value is:           2.719
 At Node [23 , 1 ]    The stock value is:            1.86
 At Node [23 , 0 ]    The stock value is:           1.273
 At Node [22 , 22]    The stock value is:        6498.825
 At Node [22 , 21]    The stock value is:        4446.637
 At Node [22 , 20]    The stock value is:        3042.485
 At Node [22 , 19]    The stock value is:        2081.735
 At Node [22 , 18]    The stock value is:        1424.368
 At Node [22 , 17]    The stock value is:         974.583
 At Node [22 , 16]    The stock value is:         666.831
 At Node [22 , 15]    The stock value is:          456.26
 At Node [22 , 14]    The stock value is:         312.183
 At Node [22 , 13]    The stock value is:         213.603
 At Node [22 , 12]    The stock value is:         146.151
 At Node [22 , 11]    The stock value is:           100.0
 At Node [22 , 10]    The stock value is:          68.422
 At Node [22 , 9 ]    The stock value is:          46.816
 At Node [22 , 8 ]    The stock value is:          32.032
 At Node [22 , 7 ]    The stock value is:          21.917
 At Node [22 , 6 ]    The stock value is:          14.996
 At Node [22 , 5 ]    The stock value is:          10.261
 At Node [22 , 4 ]    The stock value is:           7.021
 At Node [22 , 3 ]    The stock value is:           4.804
 At Node [22 , 2 ]    The stock value is:           3.287
 At Node [22 , 1 ]    The stock value is:           2.249
 At Node [22 , 0 ]    The stock value is:           1.539
 At Node [21 , 21]    The stock value is:        5375.678
 At Node [21 , 20]    The stock value is:        3678.156
 At Node [21 , 19]    The stock value is:        2516.674
 At Node [21 , 18]    The stock value is:        1721.963
 At Node [21 , 17]    The stock value is:        1178.204
 At Node [21 , 16]    The stock value is:         806.153
 At Node [21 , 15]    The stock value is:         551.587
 At Node [21 , 14]    The stock value is:         377.408
 At Node [21 , 13]    The stock value is:         258.231
 At Node [21 , 12]    The stock value is:         176.687
 At Node [21 , 11]    The stock value is:         120.893
 At Node [21 , 10]    The stock value is:          82.718
 At Node [21 , 9 ]    The stock value is:          56.597
 At Node [21 , 8 ]    The stock value is:          38.725
 At Node [21 , 7 ]    The stock value is:          26.497
 At Node [21 , 6 ]    The stock value is:          18.129
 At Node [21 , 5 ]    The stock value is:          12.405
 At Node [21 , 4 ]    The stock value is:           8.487
 At Node [21 , 3 ]    The stock value is:           5.807
 At Node [21 , 2 ]    The stock value is:           3.973
 At Node [21 , 1 ]    The stock value is:           2.719
 At Node [21 , 0 ]    The stock value is:            1.86
 At Node [20 , 20]    The stock value is:        4446.637
 At Node [20 , 19]    The stock value is:        3042.485
 At Node [20 , 18]    The stock value is:        2081.735
 At Node [20 , 17]    The stock value is:        1424.368
 At Node [20 , 16]    The stock value is:         974.583
 At Node [20 , 15]    The stock value is:         666.831
 At Node [20 , 14]    The stock value is:          456.26
 At Node [20 , 13]    The stock value is:         312.183
 At Node [20 , 12]    The stock value is:         213.603
 At Node [20 , 11]    The stock value is:         146.151
 At Node [20 , 10]    The stock value is:           100.0
 At Node [20 , 9 ]    The stock value is:          68.422
 At Node [20 , 8 ]    The stock value is:          46.816
 At Node [20 , 7 ]    The stock value is:          32.032
 At Node [20 , 6 ]    The stock value is:          21.917
 At Node [20 , 5 ]    The stock value is:          14.996
 At Node [20 , 4 ]    The stock value is:          10.261
 At Node [20 , 3 ]    The stock value is:           7.021
 At Node [20 , 2 ]    The stock value is:           4.804
 At Node [20 , 1 ]    The stock value is:           3.287
 At Node [20 , 0 ]    The stock value is:           2.249
 At Node [19 , 19]    The stock value is:        3678.156
 At Node [19 , 18]    The stock value is:        2516.674
 At Node [19 , 17]    The stock value is:        1721.963
 At Node [19 , 16]    The stock value is:        1178.204
 At Node [19 , 15]    The stock value is:         806.153
 At Node [19 , 14]    The stock value is:         551.587
 At Node [19 , 13]    The stock value is:         377.408
 At Node [19 , 12]    The stock value is:         258.231
 At Node [19 , 11]    The stock value is:         176.687
 At Node [19 , 10]    The stock value is:         120.893
 At Node [19 , 9 ]    The stock value is:          82.718
 At Node [19 , 8 ]    The stock value is:          56.597
 At Node [19 , 7 ]    The stock value is:          38.725
 At Node [19 , 6 ]    The stock value is:          26.497
 At Node [19 , 5 ]    The stock value is:          18.129
 At Node [19 , 4 ]    The stock value is:          12.405
 At Node [19 , 3 ]    The stock value is:           8.487
 At Node [19 , 2 ]    The stock value is:           5.807
 At Node [19 , 1 ]    The stock value is:           3.973
 At Node [19 , 0 ]    The stock value is:           2.719
 At Node [18 , 18]    The stock value is:        3042.485
 At Node [18 , 17]    The stock value is:        2081.735
 At Node [18 , 16]    The stock value is:        1424.368
 At Node [18 , 15]    The stock value is:         974.583
 At Node [18 , 14]    The stock value is:         666.831
 At Node [18 , 13]    The stock value is:          456.26
 At Node [18 , 12]    The stock value is:         312.183
 At Node [18 , 11]    The stock value is:         213.603
 At Node [18 , 10]    The stock value is:         146.151
 At Node [18 , 9 ]    The stock value is:           100.0
 At Node [18 , 8 ]    The stock value is:          68.422
 At Node [18 , 7 ]    The stock value is:          46.816
 At Node [18 , 6 ]    The stock value is:          32.032
 At Node [18 , 5 ]    The stock value is:          21.917
 At Node [18 , 4 ]    The stock value is:          14.996
 At Node [18 , 3 ]    The stock value is:          10.261
 At Node [18 , 2 ]    The stock value is:           7.021
 At Node [18 , 1 ]    The stock value is:           4.804
 At Node [18 , 0 ]    The stock value is:           3.287
 At Node [17 , 17]    The stock value is:        2516.674
 At Node [17 , 16]    The stock value is:        1721.963
 At Node [17 , 15]    The stock value is:        1178.204
 At Node [17 , 14]    The stock value is:         806.153
 At Node [17 , 13]    The stock value is:         551.587
 At Node [17 , 12]    The stock value is:         377.408
 At Node [17 , 11]    The stock value is:         258.231
 At Node [17 , 10]    The stock value is:         176.687
 At Node [17 , 9 ]    The stock value is:         120.893
 At Node [17 , 8 ]    The stock value is:          82.718
 At Node [17 , 7 ]    The stock value is:          56.597
 At Node [17 , 6 ]    The stock value is:          38.725
 At Node [17 , 5 ]    The stock value is:          26.497
 At Node [17 , 4 ]    The stock value is:          18.129
 At Node [17 , 3 ]    The stock value is:          12.405
 At Node [17 , 2 ]    The stock value is:           8.487
 At Node [17 , 1 ]    The stock value is:           5.807
 At Node [17 , 0 ]    The stock value is:           3.973
 At Node [16 , 16]    The stock value is:        2081.735
 At Node [16 , 15]    The stock value is:        1424.368
 At Node [16 , 14]    The stock value is:         974.583
 At Node [16 , 13]    The stock value is:         666.831
 At Node [16 , 12]    The stock value is:          456.26
 At Node [16 , 11]    The stock value is:         312.183
 At Node [16 , 10]    The stock value is:         213.603
 At Node [16 , 9 ]    The stock value is:         146.151
 At Node [16 , 8 ]    The stock value is:           100.0
 At Node [16 , 7 ]    The stock value is:          68.422
 At Node [16 , 6 ]    The stock value is:          46.816
 At Node [16 , 5 ]    The stock value is:          32.032
 At Node [16 , 4 ]    The stock value is:          21.917
 At Node [16 , 3 ]    The stock value is:          14.996
 At Node [16 , 2 ]    The stock value is:          10.261
 At Node [16 , 1 ]    The stock value is:           7.021
 At Node [16 , 0 ]    The stock value is:           4.804
 At Node [15 , 15]    The stock value is:        1721.963
 At Node [15 , 14]    The stock value is:        1178.204
 At Node [15 , 13]    The stock value is:         806.153
 At Node [15 , 12]    The stock value is:         551.587
 At Node [15 , 11]    The stock value is:         377.408
 At Node [15 , 10]    The stock value is:         258.231
 At Node [15 , 9 ]    The stock value is:         176.687
 At Node [15 , 8 ]    The stock value is:         120.893
 At Node [15 , 7 ]    The stock value is:          82.718
 At Node [15 , 6 ]    The stock value is:          56.597
 At Node [15 , 5 ]    The stock value is:          38.725
 At Node [15 , 4 ]    The stock value is:          26.497
 At Node [15 , 3 ]    The stock value is:          18.129
 At Node [15 , 2 ]    The stock value is:          12.405
 At Node [15 , 1 ]    The stock value is:           8.487
 At Node [15 , 0 ]    The stock value is:           5.807
 At Node [14 , 14]    The stock value is:        1424.368
 At Node [14 , 13]    The stock value is:         974.583
 At Node [14 , 12]    The stock value is:         666.831
 At Node [14 , 11]    The stock value is:          456.26
 At Node [14 , 10]    The stock value is:         312.183
 At Node [14 , 9 ]    The stock value is:         213.603
 At Node [14 , 8 ]    The stock value is:         146.151
 At Node [14 , 7 ]    The stock value is:           100.0
 At Node [14 , 6 ]    The stock value is:          68.422
 At Node [14 , 5 ]    The stock value is:          46.816
 At Node [14 , 4 ]    The stock value is:          32.032
 At Node [14 , 3 ]    The stock value is:          21.917
 At Node [14 , 2 ]    The stock value is:          14.996
 At Node [14 , 1 ]    The stock value is:          10.261
 At Node [14 , 0 ]    The stock value is:           7.021
 At Node [13 , 13]    The stock value is:        1178.204
 At Node [13 , 12]    The stock value is:         806.153
 At Node [13 , 11]    The stock value is:         551.587
 At Node [13 , 10]    The stock value is:         377.408
 At Node [13 , 9 ]    The stock value is:         258.231
 At Node [13 , 8 ]    The stock value is:         176.687
 At Node [13 , 7 ]    The stock value is:         120.893
 At Node [13 , 6 ]    The stock value is:          82.718
 At Node [13 , 5 ]    The stock value is:          56.597
 At Node [13 , 4 ]    The stock value is:          38.725
 At Node [13 , 3 ]    The stock value is:          26.497
 At Node [13 , 2 ]    The stock value is:          18.129
 At Node [13 , 1 ]    The stock value is:          12.405
 At Node [13 , 0 ]    The stock value is:           8.487
 At Node [12 , 12]    The stock value is:         974.583
 At Node [12 , 11]    The stock value is:         666.831
 At Node [12 , 10]    The stock value is:          456.26
 At Node [12 , 9 ]    The stock value is:         312.183
 At Node [12 , 8 ]    The stock value is:         213.603
 At Node [12 , 7 ]    The stock value is:         146.151
 At Node [12 , 6 ]    The stock value is:           100.0
 At Node [12 , 5 ]    The stock value is:          68.422
 At Node [12 , 4 ]    The stock value is:          46.816
 At Node [12 , 3 ]    The stock value is:          32.032
 At Node [12 , 2 ]    The stock value is:          21.917
 At Node [12 , 1 ]    The stock value is:          14.996
 At Node [12 , 0 ]    The stock value is:          10.261
 At Node [11 , 11]    The stock value is:         806.153
 At Node [11 , 10]    The stock value is:         551.587
 At Node [11 , 9 ]    The stock value is:         377.408
 At Node [11 , 8 ]    The stock value is:         258.231
 At Node [11 , 7 ]    The stock value is:         176.687
 At Node [11 , 6 ]    The stock value is:         120.893
 At Node [11 , 5 ]    The stock value is:          82.718
 At Node [11 , 4 ]    The stock value is:          56.597
 At Node [11 , 3 ]    The stock value is:          38.725
 At Node [11 , 2 ]    The stock value is:          26.497
 At Node [11 , 1 ]    The stock value is:          18.129
 At Node [11 , 0 ]    The stock value is:          12.405
 At Node [10 , 10]    The stock value is:         666.831
 At Node [10 , 9 ]    The stock value is:          456.26
 At Node [10 , 8 ]    The stock value is:         312.183
 At Node [10 , 7 ]    The stock value is:         213.603
 At Node [10 , 6 ]    The stock value is:         146.151
 At Node [10 , 5 ]    The stock value is:           100.0
 At Node [10 , 4 ]    The stock value is:          68.422
 At Node [10 , 3 ]    The stock value is:          46.816
 At Node [10 , 2 ]    The stock value is:          32.032
 At Node [10 , 1 ]    The stock value is:          21.917
 At Node [10 , 0 ]    The stock value is:          14.996
 At Node [9  , 9 ]    The stock value is:         551.587
 At Node [9  , 8 ]    The stock value is:         377.408
 At Node [9  , 7 ]    The stock value is:         258.231
 At Node [9  , 6 ]    The stock value is:         176.687
 At Node [9  , 5 ]    The stock value is:         120.893
 At Node [9  , 4 ]    The stock value is:          82.718
 At Node [9  , 3 ]    The stock value is:          56.597
 At Node [9  , 2 ]    The stock value is:          38.725
 At Node [9  , 1 ]    The stock value is:          26.497
 At Node [9  , 0 ]    The stock value is:          18.129
 At Node [8  , 8 ]    The stock value is:          456.26
 At Node [8  , 7 ]    The stock value is:         312.183
 At Node [8  , 6 ]    The stock value is:         213.603
 At Node [8  , 5 ]    The stock value is:         146.151
 At Node [8  , 4 ]    The stock value is:           100.0
 At Node [8  , 3 ]    The stock value is:          68.422
 At Node [8  , 2 ]    The stock value is:          46.816
 At Node [8  , 1 ]    The stock value is:          32.032
 At Node [8  , 0 ]    The stock value is:          21.917
 At Node [7  , 7 ]    The stock value is:         377.408
 At Node [7  , 6 ]    The stock value is:         258.231
 At Node [7  , 5 ]    The stock value is:         176.687
 At Node [7  , 4 ]    The stock value is:         120.893
 At Node [7  , 3 ]    The stock value is:          82.718
 At Node [7  , 2 ]    The stock value is:          56.597
 At Node [7  , 1 ]    The stock value is:          38.725
 At Node [7  , 0 ]    The stock value is:          26.497
 At Node [6  , 6 ]    The stock value is:         312.183
 At Node [6  , 5 ]    The stock value is:         213.603
 At Node [6  , 4 ]    The stock value is:         146.151
 At Node [6  , 3 ]    The stock value is:           100.0
 At Node [6  , 2 ]    The stock value is:          68.422
 At Node [6  , 1 ]    The stock value is:          46.816
 At Node [6  , 0 ]    The stock value is:          32.032
 At Node [5  , 5 ]    The stock value is:         258.231
 At Node [5  , 4 ]    The stock value is:         176.687
 At Node [5  , 3 ]    The stock value is:         120.893
 At Node [5  , 2 ]    The stock value is:          82.718
 At Node [5  , 1 ]    The stock value is:          56.597
 At Node [5  , 0 ]    The stock value is:          38.725
 At Node [4  , 4 ]    The stock value is:         213.603
 At Node [4  , 3 ]    The stock value is:         146.151
 At Node [4  , 2 ]    The stock value is:           100.0
 At Node [4  , 1 ]    The stock value is:          68.422
 At Node [4  , 0 ]    The stock value is:          46.816
 At Node [3  , 3 ]    The stock value is:         176.687
 At Node [3  , 2 ]    The stock value is:         120.893
 At Node [3  , 1 ]    The stock value is:          82.718
 At Node [3  , 0 ]    The stock value is:          56.597
 At Node [2  , 2 ]    The stock value is:         146.151
 At Node [2  , 1 ]    The stock value is:           100.0
 At Node [2  , 0 ]    The stock value is:          68.422
 At Node [1  , 1 ]    The stock value is:         120.893
 At Node [1  , 0 ]    The stock value is:          82.718
 At Node [0  , 0 ]    The stock value is:           100.0
In [7]:
for (i, j), value in O_vals.items():
    print(f" At Node [{i:<3}, {i-j:<2}]    The option value is: {value:>15}")
 At Node [25 , 25]    The option value is:       11367.583
 At Node [25 , 24]    The option value is:        7741.632
 At Node [25 , 23]    The option value is:        5260.678
 At Node [25 , 22]    The option value is:        3563.156
 At Node [25 , 21]    The option value is:        2401.674
 At Node [25 , 20]    The option value is:        1606.963
 At Node [25 , 19]    The option value is:        1063.204
 At Node [25 , 18]    The option value is:         691.153
 At Node [25 , 17]    The option value is:         436.587
 At Node [25 , 16]    The option value is:         262.408
 At Node [25 , 15]    The option value is:         143.231
 At Node [25 , 14]    The option value is:          61.687
 At Node [25 , 13]    The option value is:           5.893
 At Node [25 , 12]    The option value is:             0.0
 At Node [25 , 11]    The option value is:             0.0
 At Node [25 , 10]    The option value is:             0.0
 At Node [25 , 9 ]    The option value is:             0.0
 At Node [25 , 8 ]    The option value is:             0.0
 At Node [25 , 7 ]    The option value is:             0.0
 At Node [25 , 6 ]    The option value is:             0.0
 At Node [25 , 5 ]    The option value is:             0.0
 At Node [25 , 4 ]    The option value is:             0.0
 At Node [25 , 3 ]    The option value is:             0.0
 At Node [25 , 2 ]    The option value is:             0.0
 At Node [25 , 1 ]    The option value is:             0.0
 At Node [25 , 0 ]    The option value is:             0.0
 At Node [24 , 24]    The option value is:        9383.128
 At Node [24 , 23]    The option value is:        6383.825
 At Node [24 , 22]    The option value is:        4331.637
 At Node [24 , 21]    The option value is:        2927.485
 At Node [24 , 20]    The option value is:        1966.735
 At Node [24 , 19]    The option value is:        1309.368
 At Node [24 , 18]    The option value is:         859.583
 At Node [24 , 17]    The option value is:         551.831
 At Node [24 , 16]    The option value is:          341.26
 At Node [24 , 15]    The option value is:         197.183
 At Node [24 , 14]    The option value is:          98.754
 At Node [24 , 13]    The option value is:          31.974
 At Node [24 , 12]    The option value is:           2.767
 At Node [24 , 11]    The option value is:             0.0
 At Node [24 , 10]    The option value is:             0.0
 At Node [24 , 9 ]    The option value is:             0.0
 At Node [24 , 8 ]    The option value is:             0.0
 At Node [24 , 7 ]    The option value is:             0.0
 At Node [24 , 6 ]    The option value is:             0.0
 At Node [24 , 5 ]    The option value is:             0.0
 At Node [24 , 4 ]    The option value is:             0.0
 At Node [24 , 3 ]    The option value is:             0.0
 At Node [24 , 2 ]    The option value is:             0.0
 At Node [24 , 1 ]    The option value is:             0.0
 At Node [24 , 0 ]    The option value is:             0.0
 At Node [23 , 23]    The option value is:        7741.632
 At Node [23 , 22]    The option value is:        5260.678
 At Node [23 , 21]    The option value is:        3563.156
 At Node [23 , 20]    The option value is:        2401.674
 At Node [23 , 19]    The option value is:        1606.963
 At Node [23 , 18]    The option value is:        1063.204
 At Node [23 , 17]    The option value is:         691.153
 At Node [23 , 16]    The option value is:         436.587
 At Node [23 , 15]    The option value is:         262.408
 At Node [23 , 14]    The option value is:         143.231
 At Node [23 , 13]    The option value is:          62.698
 At Node [23 , 12]    The option value is:          16.427
 At Node [23 , 11]    The option value is:           1.299
 At Node [23 , 10]    The option value is:             0.0
 At Node [23 , 9 ]    The option value is:             0.0
 At Node [23 , 8 ]    The option value is:             0.0
 At Node [23 , 7 ]    The option value is:             0.0
 At Node [23 , 6 ]    The option value is:             0.0
 At Node [23 , 5 ]    The option value is:             0.0
 At Node [23 , 4 ]    The option value is:             0.0
 At Node [23 , 3 ]    The option value is:             0.0
 At Node [23 , 2 ]    The option value is:             0.0
 At Node [23 , 1 ]    The option value is:             0.0
 At Node [23 , 0 ]    The option value is:             0.0
 At Node [22 , 22]    The option value is:        6383.825
 At Node [22 , 21]    The option value is:        4331.637
 At Node [22 , 20]    The option value is:        2927.485
 At Node [22 , 19]    The option value is:        1966.735
 At Node [22 , 18]    The option value is:        1309.368
 At Node [22 , 17]    The option value is:         859.583
 At Node [22 , 16]    The option value is:         551.831
 At Node [22 , 15]    The option value is:          341.26
 At Node [22 , 14]    The option value is:         197.183
 At Node [22 , 13]    The option value is:           99.27
 At Node [22 , 12]    The option value is:          37.828
 At Node [22 , 11]    The option value is:           8.377
 At Node [22 , 10]    The option value is:            0.61
 At Node [22 , 9 ]    The option value is:             0.0
 At Node [22 , 8 ]    The option value is:             0.0
 At Node [22 , 7 ]    The option value is:             0.0
 At Node [22 , 6 ]    The option value is:             0.0
 At Node [22 , 5 ]    The option value is:             0.0
 At Node [22 , 4 ]    The option value is:             0.0
 At Node [22 , 3 ]    The option value is:             0.0
 At Node [22 , 2 ]    The option value is:             0.0
 At Node [22 , 1 ]    The option value is:             0.0
 At Node [22 , 0 ]    The option value is:             0.0
 At Node [21 , 21]    The option value is:        5260.678
 At Node [21 , 20]    The option value is:        3563.156
 At Node [21 , 19]    The option value is:        2401.674
 At Node [21 , 18]    The option value is:        1606.963
 At Node [21 , 17]    The option value is:        1063.204
 At Node [21 , 16]    The option value is:         691.153
 At Node [21 , 15]    The option value is:         436.587
 At Node [21 , 14]    The option value is:         262.408
 At Node [21 , 13]    The option value is:         143.279
 At Node [21 , 12]    The option value is:          65.929
 At Node [21 , 11]    The option value is:          22.039
 At Node [21 , 10]    The option value is:           4.245
 At Node [21 , 9 ]    The option value is:           0.286
 At Node [21 , 8 ]    The option value is:             0.0
 At Node [21 , 7 ]    The option value is:             0.0
 At Node [21 , 6 ]    The option value is:             0.0
 At Node [21 , 5 ]    The option value is:             0.0
 At Node [21 , 4 ]    The option value is:             0.0
 At Node [21 , 3 ]    The option value is:             0.0
 At Node [21 , 2 ]    The option value is:             0.0
 At Node [21 , 1 ]    The option value is:             0.0
 At Node [21 , 0 ]    The option value is:             0.0
 At Node [20 , 20]    The option value is:        4331.637
 At Node [20 , 19]    The option value is:        2927.485
 At Node [20 , 18]    The option value is:        1966.735
 At Node [20 , 17]    The option value is:        1309.368
 At Node [20 , 16]    The option value is:         859.583
 At Node [20 , 15]    The option value is:         551.831
 At Node [20 , 14]    The option value is:          341.26
 At Node [20 , 13]    The option value is:         197.183
 At Node [20 , 12]    The option value is:         100.943
 At Node [20 , 11]    The option value is:          42.211
 At Node [20 , 10]    The option value is:          12.516
 At Node [20 , 9 ]    The option value is:           2.139
 At Node [20 , 8 ]    The option value is:           0.135
 At Node [20 , 7 ]    The option value is:             0.0
 At Node [20 , 6 ]    The option value is:             0.0
 At Node [20 , 5 ]    The option value is:             0.0
 At Node [20 , 4 ]    The option value is:             0.0
 At Node [20 , 3 ]    The option value is:             0.0
 At Node [20 , 2 ]    The option value is:             0.0
 At Node [20 , 1 ]    The option value is:             0.0
 At Node [20 , 0 ]    The option value is:             0.0
 At Node [19 , 19]    The option value is:        3563.156
 At Node [19 , 18]    The option value is:        2401.674
 At Node [19 , 17]    The option value is:        1606.963
 At Node [19 , 16]    The option value is:        1063.204
 At Node [19 , 15]    The option value is:         691.153
 At Node [19 , 14]    The option value is:         436.587
 At Node [19 , 13]    The option value is:         262.408
 At Node [19 , 12]    The option value is:         144.134
 At Node [19 , 11]    The option value is:          68.953
 At Node [19 , 10]    The option value is:          26.212
 At Node [19 , 9 ]    The option value is:           6.969
 At Node [19 , 8 ]    The option value is:           1.073
 At Node [19 , 7 ]    The option value is:           0.063
 At Node [19 , 6 ]    The option value is:             0.0
 At Node [19 , 5 ]    The option value is:             0.0
 At Node [19 , 4 ]    The option value is:             0.0
 At Node [19 , 3 ]    The option value is:             0.0
 At Node [19 , 2 ]    The option value is:             0.0
 At Node [19 , 1 ]    The option value is:             0.0
 At Node [19 , 0 ]    The option value is:             0.0
 At Node [18 , 18]    The option value is:        2927.485
 At Node [18 , 17]    The option value is:        1966.735
 At Node [18 , 16]    The option value is:        1309.368
 At Node [18 , 15]    The option value is:         859.583
 At Node [18 , 14]    The option value is:         551.831
 At Node [18 , 13]    The option value is:          341.26
 At Node [18 , 12]    The option value is:         197.183
 At Node [18 , 11]    The option value is:         102.889
 At Node [18 , 10]    The option value is:          45.762
 At Node [18 , 9 ]    The option value is:          15.867
 At Node [18 , 8 ]    The option value is:           3.821
 At Node [18 , 7 ]    The option value is:           0.536
 At Node [18 , 6 ]    The option value is:            0.03
 At Node [18 , 5 ]    The option value is:             0.0
 At Node [18 , 4 ]    The option value is:             0.0
 At Node [18 , 3 ]    The option value is:             0.0
 At Node [18 , 2 ]    The option value is:             0.0
 At Node [18 , 1 ]    The option value is:             0.0
 At Node [18 , 0 ]    The option value is:             0.0
 At Node [17 , 17]    The option value is:        2401.674
 At Node [17 , 16]    The option value is:        1606.963
 At Node [17 , 15]    The option value is:        1063.204
 At Node [17 , 14]    The option value is:         691.153
 At Node [17 , 13]    The option value is:         436.587
 At Node [17 , 12]    The option value is:         262.408
 At Node [17 , 11]    The option value is:         145.127
 At Node [17 , 10]    The option value is:          71.679
 At Node [17 , 9 ]    The option value is:           29.59
 At Node [17 , 8 ]    The option value is:           9.401
 At Node [17 , 7 ]    The option value is:           2.068
 At Node [17 , 6 ]    The option value is:           0.267
 At Node [17 , 5 ]    The option value is:           0.014
 At Node [17 , 4 ]    The option value is:             0.0
 At Node [17 , 3 ]    The option value is:             0.0
 At Node [17 , 2 ]    The option value is:             0.0
 At Node [17 , 1 ]    The option value is:             0.0
 At Node [17 , 0 ]    The option value is:             0.0
 At Node [16 , 16]    The option value is:        1966.735
 At Node [16 , 15]    The option value is:        1309.368
 At Node [16 , 14]    The option value is:         859.583
 At Node [16 , 13]    The option value is:         551.831
 At Node [16 , 12]    The option value is:          341.26
 At Node [16 , 11]    The option value is:         197.322
 At Node [16 , 10]    The option value is:         104.747
 At Node [16 , 9 ]    The option value is:          48.767
 At Node [16 , 8 ]    The option value is:          18.694
 At Node [16 , 7 ]    The option value is:            5.47
 At Node [16 , 6 ]    The option value is:           1.107
 At Node [16 , 5 ]    The option value is:           0.132
 At Node [16 , 4 ]    The option value is:           0.007
 At Node [16 , 3 ]    The option value is:             0.0
 At Node [16 , 2 ]    The option value is:             0.0
 At Node [16 , 1 ]    The option value is:             0.0
 At Node [16 , 0 ]    The option value is:             0.0
 At Node [15 , 15]    The option value is:        1606.963
 At Node [15 , 14]    The option value is:        1063.204
 At Node [15 , 13]    The option value is:         691.153
 At Node [15 , 12]    The option value is:         436.587
 At Node [15 , 11]    The option value is:         262.408
 At Node [15 , 10]    The option value is:         146.142
 At Node [15 , 9 ]    The option value is:          74.087
 At Node [15 , 8 ]    The option value is:          32.445
 At Node [15 , 7 ]    The option value is:          11.571
 At Node [15 , 6 ]    The option value is:           3.134
 At Node [15 , 5 ]    The option value is:           0.588
 At Node [15 , 4 ]    The option value is:           0.066
 At Node [15 , 3 ]    The option value is:           0.003
 At Node [15 , 2 ]    The option value is:             0.0
 At Node [15 , 1 ]    The option value is:             0.0
 At Node [15 , 0 ]    The option value is:             0.0
 At Node [14 , 14]    The option value is:        1309.368
 At Node [14 , 13]    The option value is:         859.583
 At Node [14 , 12]    The option value is:         551.831
 At Node [14 , 11]    The option value is:          341.26
 At Node [14 , 10]    The option value is:         197.841
 At Node [14 , 9 ]    The option value is:         106.453
 At Node [14 , 8 ]    The option value is:          51.355
 At Node [14 , 7 ]    The option value is:          21.143
 At Node [14 , 6 ]    The option value is:           7.034
 At Node [14 , 5 ]    The option value is:           1.772
 At Node [14 , 4 ]    The option value is:           0.309
 At Node [14 , 3 ]    The option value is:           0.032
 At Node [14 , 2 ]    The option value is:           0.001
 At Node [14 , 1 ]    The option value is:             0.0
 At Node [14 , 0 ]    The option value is:             0.0
 At Node [13 , 13]    The option value is:        1063.204
 At Node [13 , 12]    The option value is:         691.153
 At Node [13 , 11]    The option value is:         436.587
 At Node [13 , 10]    The option value is:         262.408
 At Node [13 , 9 ]    The option value is:         147.256
 At Node [13 , 8 ]    The option value is:          76.209
 At Node [13 , 7 ]    The option value is:          34.911
 At Node [13 , 6 ]    The option value is:          13.519
 At Node [13 , 5 ]    The option value is:           4.207
 At Node [13 , 4 ]    The option value is:            0.99
 At Node [13 , 3 ]    The option value is:           0.162
 At Node [13 , 2 ]    The option value is:           0.016
 At Node [13 , 1 ]    The option value is:           0.001
 At Node [13 , 0 ]    The option value is:             0.0
 At Node [12 , 12]    The option value is:         859.583
 At Node [12 , 11]    The option value is:         551.831
 At Node [12 , 10]    The option value is:          341.26
 At Node [12 , 9 ]    The option value is:          198.41
 At Node [12 , 8 ]    The option value is:          108.06
 At Node [12 , 7 ]    The option value is:          53.611
 At Node [12 , 6 ]    The option value is:          23.296
 At Node [12 , 5 ]    The option value is:           8.496
 At Node [12 , 4 ]    The option value is:           2.481
 At Node [12 , 3 ]    The option value is:           0.547
 At Node [12 , 2 ]    The option value is:           0.084
 At Node [12 , 1 ]    The option value is:           0.008
 At Node [12 , 0 ]    The option value is:             0.0
 At Node [11 , 11]    The option value is:         691.153
 At Node [11 , 10]    The option value is:         436.587
 At Node [11 , 9 ]    The option value is:         262.408
 At Node [11 , 8 ]    The option value is:         148.344
 At Node [11 , 7 ]    The option value is:          78.116
 At Node [11 , 6 ]    The option value is:          37.069
 At Node [11 , 5 ]    The option value is:          15.277
 At Node [11 , 4 ]    The option value is:           5.256
 At Node [11 , 3 ]    The option value is:           1.444
 At Node [11 , 2 ]    The option value is:             0.3
 At Node [11 , 1 ]    The option value is:           0.043
 At Node [11 , 0 ]    The option value is:           0.004
 At Node [10 , 10]    The option value is:         551.831
 At Node [10 , 9 ]    The option value is:          341.26
 At Node [10 , 8 ]    The option value is:         198.965
 At Node [10 , 7 ]    The option value is:         109.545
 At Node [10 , 6 ]    The option value is:          55.609
 At Node [10 , 5 ]    The option value is:          25.207
 At Node [10 , 4 ]    The option value is:           9.858
 At Node [10 , 3 ]    The option value is:           3.206
 At Node [10 , 2 ]    The option value is:           0.831
 At Node [10 , 1 ]    The option value is:           0.163
 At Node [10 , 0 ]    The option value is:           0.022
 At Node [9  , 9 ]    The option value is:         436.587
 At Node [9  , 8 ]    The option value is:         262.408
 At Node [9  , 7 ]    The option value is:         149.363
 At Node [9  , 6 ]    The option value is:          79.833
 At Node [9  , 5 ]    The option value is:          38.983
 At Node [9  , 4 ]    The option value is:           16.87
 At Node [9  , 3 ]    The option value is:           6.266
 At Node [9  , 2 ]    The option value is:            1.93
 At Node [9  , 1 ]    The option value is:           0.474
 At Node [9  , 0 ]    The option value is:           0.088
 At Node [8  , 8 ]    The option value is:          341.26
 At Node [8  , 7 ]    The option value is:         199.485
 At Node [8  , 6 ]    The option value is:           110.9
 At Node [8  , 5 ]    The option value is:          57.392
 At Node [8  , 4 ]    The option value is:          26.919
 At Node [8  , 3 ]    The option value is:          11.121
 At Node [8  , 2 ]    The option value is:           3.927
 At Node [8  , 1 ]    The option value is:           1.148
 At Node [8  , 0 ]    The option value is:           0.267
 At Node [7  , 7 ]    The option value is:         262.408
 At Node [7  , 6 ]    The option value is:         150.299
 At Node [7  , 5 ]    The option value is:           81.38
 At Node [7  , 4 ]    The option value is:          40.695
 At Node [7  , 3 ]    The option value is:          18.319
 At Node [7  , 2 ]    The option value is:           7.227
 At Node [7  , 1 ]    The option value is:            2.43
 At Node [7  , 0 ]    The option value is:           0.676
 At Node [6  , 6 ]    The option value is:         199.963
 At Node [6  , 5 ]    The option value is:         112.129
 At Node [6  , 4 ]    The option value is:          58.993
 At Node [6  , 3 ]    The option value is:          28.462
 At Node [6  , 2 ]    The option value is:          12.292
 At Node [6  , 1 ]    The option value is:           4.635
 At Node [6  , 0 ]    The option value is:           1.486
 At Node [5  , 5 ]    The option value is:         151.151
 At Node [5  , 4 ]    The option value is:          82.775
 At Node [5  , 3 ]    The option value is:          42.234
 At Node [5  , 2 ]    The option value is:          19.641
 At Node [5  , 1 ]    The option value is:           8.138
 At Node [5  , 0 ]    The option value is:           2.935
 At Node [4  , 4 ]    The option value is:         113.242
 At Node [4  , 3 ]    The option value is:          60.434
 At Node [4  , 2 ]    The option value is:          29.861
 At Node [4  , 1 ]    The option value is:          13.378
 At Node [4  , 0 ]    The option value is:            5.32
 At Node [3  , 3 ]    The option value is:          84.033
 At Node [3  , 2 ]    The option value is:          43.625
 At Node [3  , 1 ]    The option value is:          20.853
 At Node [3  , 0 ]    The option value is:           8.999
 At Node [2  , 2 ]    The option value is:          61.735
 At Node [2  , 1 ]    The option value is:          31.133
 At Node [2  , 0 ]    The option value is:          14.387
 At Node [1  , 1 ]    The option value is:          44.885
 At Node [1  , 0 ]    The option value is:          21.965
 At Node [0  , 0 ]    The option value is:          32.292

7.1. Intermediate Model Construction

In [8]:
import numpy as np


def FASB_Binomial(n, S, K, r,q, v, t, vest_per, ee, PutCall):  

    # Solved Parameters

    At = t/n                                #Timestep

    u = np.exp(v*np.sqrt(At))               # Upmove

    d = 1./u                                # Downmove

    p = (np.exp((r-q)*At)-d) / (u-d)         # Risk-Neutral Probability



    #Binomial price tree

    stockvalue = np.zeros((n+1,n+1))                #Create symmetrical zero-filled array with dimensions of Timesteps + 1

    stockvalue[0,0] = S                             #Location of current stock price in matrix (1st element in 1st column)
                                                    # Note the rows express time progression and columns tree level
    
    for i in range(1,n+1):                          #Outer loop: For each timestep...

        stockvalue[i,0] = stockvalue[i-1,0]*u       # Compute future stockprice as product of prev. price and upmoves

        for j in range(1,i+1):                      # Inner Loop: For each time step at each tree level...
            
            stockvalue[i,j] = stockvalue[i-1,j-1]*d # Compute associated downmove stock value for each upmove
                                                    # (Nested for loop."Inner loop" will be executed one time 
                                                    # for each iteration of the "outer loop").
                                                     
             

    #Option value at terminal nodes   

    optionvalue = np.zeros((n+1,n+1))               #Create symmetrical zero-filled matrix with dimensions of Timesteps + 1

    for j in range(n+1):                            # For each node at the terminal time step...
                                                    # Compute instrinsic value based on put or call position
        if PutCall=="C": # Call

            optionvalue[n,j] = max(0, stockvalue[n,j]-K)      

        elif PutCall=="P": #Put

            optionvalue[n,j] = max(0, K-stockvalue[n,j])

    

    #Backward induction process for option values at interim nodes    

    for i in range(n-1,-1,-1):                    # For each time step, working backwards, from penultimate to first...

        for j in range(i+1):                      # For each node at each of above time step...
                                                  # Compute the maximum of the expected value and the current intrinsic val.

                if PutCall=="P":                 

                    optionvalue[i,j] = max(0, 
                                           K-stockvalue[i,j],np.exp(-r*At)*(p*optionvalue[i+1,j]+(1-p)*optionvalue[i+1,j+1]))

                elif PutCall=="C":

                    optionvalue[i,j] = max(0, 
                                           stockvalue[i,j]-K,np.exp(-r*At)*(p*optionvalue[i+1,j]+(1-p)*optionvalue[i+1,j+1]))
    
    FASB = optionvalue[0,0]*((1-ee)**(vest_per))

    #return optionvalue[0,0]
    
    return FASB, stockvalue, optionvalue, n, S, K, r, q, v, t, vest_per, ee

7.2. Intermediate Model Implementation and Output

In [9]:
# Inputs

n = 25               #number of steps

S = 100              #initial underlying asset price

r = 0.05             #risk-free interest rate

q = 0.025             #risk-free interest rate

K = 115              #strike price

v = 0.3              #volatility

t = 8.5              #expected life

vest_per = 3         #volatility

ee = 0.03            #expected forefeiture through employee exit



result1 = FASB_Binomial(n, S, K, r,q, v, t, vest_per, ee, PutCall="C")

header1 = ['Opt. Val.(Interm. Model)','Spot', 'Strike', 'Rfr','Div. Yld.', 'Vol.',
           'EL', 'Time Steps','Vest.','Forfeit.']
table1 = [[result1[0], result1[4],result1[5],result1[6],result1[7],result1[8],result1[9],result1[3],result1[10],result1[11]]]

print(tabulate(table1,header1))
  Opt. Val.(Interm. Model)    Spot    Strike    Rfr    Div. Yld.    Vol.    EL    Time Steps    Vest.    Forfeit.
--------------------------  ------  --------  -----  -----------  ------  ----  ------------  -------  ----------
                   27.3783     100       115   0.05        0.025     0.3   8.5            25        3        0.03

8.1. Final Model Construction

In [10]:
from numpy import exp,sqrt

def HW_binomial_call(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M):
    
    
    #Solved Parameters
    
    dt = T / Nsteps
    u = exp(sigma * sqrt(dt))
    d = 1. / u
    a = exp(r*dt) * exp(-div*dt)
    p = (a - d) / (u - d)
    
    #vector of payoff and option price in the tree
    S = np.zeros([Nsteps + 1, Nsteps + 1])
    f = np.zeros([Nsteps + 1, Nsteps + 1])
    
    # compute the S value at time t
    for i in range(0,Nsteps+1):
        for j in range(0,i+1):
            S[i,j] = S0 * u ** (j) * d ** (i - j)

    for j in range(0,Nsteps+1):
        f[Nsteps , j] = max(S[Nsteps, j] - K, 0)
    
    #  the backward recursion
    for i in range(Nsteps-1,-1,-1):
        for j in range(0,i+1):
            if i*dt > Tvest and S[i,j]>= M * K:
                f[i, j]= max(S[i, j] - K,0)
            elif i*dt > Tvest and S[i,j]< M * K:
                f[i, j]=(ee2*dt)*(max(S[i, j] - K, 0))+(1-ee2*dt)*exp(-r*dt)*(p*f[i + 1, j + 1] + (1 - p) * f[i + 1, j])      
            else:
                f[i, j] = (1-ee1*dt)*exp(-r * dt) * (p * f[i + 1, j + 1] + (1 - p) * f[i + 1, j])
    
    return f[0, 0], S, f, Nsteps, S0, K, r, div, sigma, T, Tvest, ee1, ee2, M

8.2. Final Model Implementation

In [11]:
    #Inputs
    
    S0 = 100
    K = 115
    T = 10
    r = 0.05
    div = 0.025
    sigma = 0.30
    Nsteps = 25
    
    Tvest=2 #vesting time
    ee1 = 3/100 #forfeiture rate pre-vest
    ee2 = 8/100 #forfeiture rate post-vest
    M = 3
    
    
    result2 = HW_binomial_call(S0, K, T, r, div, sigma, Nsteps,Tvest, ee1,ee2, M)
    

    header2 = ['Opt Val (Fin)','Spot', 'Strike', 'Rfr','Div Yld', 'Vol','TTE', 'T Steps',
               'Vest','Forf (<V)','Forf (>V)', 'M']
    
    table2 = [[result2[0], result2[4],result2[5],result2[6],result2[7],result2[8],result2[9],result2[3],
               result2[10],result2[11],result2[12],result2[13]]]

    print(tabulate(table2,header2))
  Opt Val (Fin)    Spot    Strike    Rfr    Div Yld    Vol    TTE    T Steps    Vest    Forf (<V)    Forf (>V)    M
---------------  ------  --------  -----  ---------  -----  -----  ---------  ------  -----------  -----------  ---
        26.3072     100       115   0.05      0.025    0.3     10         25       2         0.03         0.08    3

8.3. Final Model Output: Summary

In [12]:
import pandas as pd

header_res = ['Opt Value (Final HW Model)','Spot', 'Strike', 'Risk Free Rate','Dividend Yld', 'Volaltility','Time to Exp.', 'Time Steps',
               'Time to Vest','Pre-Vest Forf.','Post-Vest Forf', 'Exercise Multiple']

df = pd.DataFrame()

df['Output/Input Variable']  = ['Option Value (Final Model)','Spot', 'Strike', 'Risk Free Rate','Dividend Yld', 
                                'Volaltility','Time to Expiry', 'Time Steps', 'Time to Vest',
                                'Pre-Vest Forfeit.','Post-Vest Forfeit. ', 'Exercise Mult.']

df['Value'] = [result2[0], result2[4],result2[5],result2[6],result2[7],result2[8],result2[9],result2[3],
               result2[10],result2[11],result2[12],result2[13]] 


df['Value'] = df['Value'].round(2)


df
Out[12]:
Output/Input Variable Value
0 Option Value (Final Model) 26.31
1 Spot 100.00
2 Strike 115.00
3 Risk Free Rate 0.05
4 Dividend Yld 0.02
5 Volaltility 0.30
6 Time to Expiry 10.00
7 Time Steps 25.00
8 Time to Vest 2.00
9 Pre-Vest Forfeit. 0.03
10 Post-Vest Forfeit. 0.08
11 Exercise Mult. 3.00

8.4. Final Model Output: Tree Visualization

In [13]:
    # Tree Visualization
    px_HW  = result2[1]
    opx_HW = result2[2]
    
    # Create empty dictionaries to hold all node values at all time steps
    S_vals_HW = {} 
    O_vals_HW = {}
    
    # Assigns keys and values to S_Vals dictionary
    for j in range(0, Nsteps+1): 

            S_vals_HW[(Nsteps, j)] = round(px_HW[Nsteps,j], 3)                 #Terminal Stock Values
    
    for i in range(Nsteps-1,-1,-1):
        
        for j in range(i+1):
            
            S_vals_HW[(i, j)] = round(px_HW[i,j],3)                 #Interim Stock Values 

    # Assigns keys and values to O_Vals dictionary
    for j in range(0, Nsteps+1): 

            O_vals_HW[(Nsteps, j)] = round(opx_HW[Nsteps,j], 3)                 #Terminal Option Values
    
    for i in range(Nsteps-1,-1,-1):
        
        for j in range(i+1):
            
            O_vals_HW[(i, j)] = round(opx_HW[i,j],3)                 #Interim Option Values 
In [14]:
# Stock Price Path
for (i, j), value in S_vals_HW.items():
    print(f" At Node [{i:<3}, {j:<2}]    The stock value is: {value:>15}")
 At Node [25 , 0 ]    The stock value is:           0.871
 At Node [25 , 1 ]    The stock value is:           1.273
 At Node [25 , 2 ]    The stock value is:            1.86
 At Node [25 , 3 ]    The stock value is:           2.719
 At Node [25 , 4 ]    The stock value is:           3.973
 At Node [25 , 5 ]    The stock value is:           5.807
 At Node [25 , 6 ]    The stock value is:           8.487
 At Node [25 , 7 ]    The stock value is:          12.405
 At Node [25 , 8 ]    The stock value is:          18.129
 At Node [25 , 9 ]    The stock value is:          26.497
 At Node [25 , 10]    The stock value is:          38.725
 At Node [25 , 11]    The stock value is:          56.597
 At Node [25 , 12]    The stock value is:          82.718
 At Node [25 , 13]    The stock value is:         120.893
 At Node [25 , 14]    The stock value is:         176.687
 At Node [25 , 15]    The stock value is:         258.231
 At Node [25 , 16]    The stock value is:         377.408
 At Node [25 , 17]    The stock value is:         551.587
 At Node [25 , 18]    The stock value is:         806.153
 At Node [25 , 19]    The stock value is:        1178.204
 At Node [25 , 20]    The stock value is:        1721.963
 At Node [25 , 21]    The stock value is:        2516.674
 At Node [25 , 22]    The stock value is:        3678.156
 At Node [25 , 23]    The stock value is:        5375.678
 At Node [25 , 24]    The stock value is:        7856.632
 At Node [25 , 25]    The stock value is:       11482.583
 At Node [24 , 0 ]    The stock value is:           1.053
 At Node [24 , 1 ]    The stock value is:           1.539
 At Node [24 , 2 ]    The stock value is:           2.249
 At Node [24 , 3 ]    The stock value is:           3.287
 At Node [24 , 4 ]    The stock value is:           4.804
 At Node [24 , 5 ]    The stock value is:           7.021
 At Node [24 , 6 ]    The stock value is:          10.261
 At Node [24 , 7 ]    The stock value is:          14.996
 At Node [24 , 8 ]    The stock value is:          21.917
 At Node [24 , 9 ]    The stock value is:          32.032
 At Node [24 , 10]    The stock value is:          46.816
 At Node [24 , 11]    The stock value is:          68.422
 At Node [24 , 12]    The stock value is:           100.0
 At Node [24 , 13]    The stock value is:         146.151
 At Node [24 , 14]    The stock value is:         213.603
 At Node [24 , 15]    The stock value is:         312.183
 At Node [24 , 16]    The stock value is:          456.26
 At Node [24 , 17]    The stock value is:         666.831
 At Node [24 , 18]    The stock value is:         974.583
 At Node [24 , 19]    The stock value is:        1424.368
 At Node [24 , 20]    The stock value is:        2081.735
 At Node [24 , 21]    The stock value is:        3042.485
 At Node [24 , 22]    The stock value is:        4446.637
 At Node [24 , 23]    The stock value is:        6498.825
 At Node [24 , 24]    The stock value is:        9498.128
 At Node [23 , 0 ]    The stock value is:           1.273
 At Node [23 , 1 ]    The stock value is:            1.86
 At Node [23 , 2 ]    The stock value is:           2.719
 At Node [23 , 3 ]    The stock value is:           3.973
 At Node [23 , 4 ]    The stock value is:           5.807
 At Node [23 , 5 ]    The stock value is:           8.487
 At Node [23 , 6 ]    The stock value is:          12.405
 At Node [23 , 7 ]    The stock value is:          18.129
 At Node [23 , 8 ]    The stock value is:          26.497
 At Node [23 , 9 ]    The stock value is:          38.725
 At Node [23 , 10]    The stock value is:          56.597
 At Node [23 , 11]    The stock value is:          82.718
 At Node [23 , 12]    The stock value is:         120.893
 At Node [23 , 13]    The stock value is:         176.687
 At Node [23 , 14]    The stock value is:         258.231
 At Node [23 , 15]    The stock value is:         377.408
 At Node [23 , 16]    The stock value is:         551.587
 At Node [23 , 17]    The stock value is:         806.153
 At Node [23 , 18]    The stock value is:        1178.204
 At Node [23 , 19]    The stock value is:        1721.963
 At Node [23 , 20]    The stock value is:        2516.674
 At Node [23 , 21]    The stock value is:        3678.156
 At Node [23 , 22]    The stock value is:        5375.678
 At Node [23 , 23]    The stock value is:        7856.632
 At Node [22 , 0 ]    The stock value is:           1.539
 At Node [22 , 1 ]    The stock value is:           2.249
 At Node [22 , 2 ]    The stock value is:           3.287
 At Node [22 , 3 ]    The stock value is:           4.804
 At Node [22 , 4 ]    The stock value is:           7.021
 At Node [22 , 5 ]    The stock value is:          10.261
 At Node [22 , 6 ]    The stock value is:          14.996
 At Node [22 , 7 ]    The stock value is:          21.917
 At Node [22 , 8 ]    The stock value is:          32.032
 At Node [22 , 9 ]    The stock value is:          46.816
 At Node [22 , 10]    The stock value is:          68.422
 At Node [22 , 11]    The stock value is:           100.0
 At Node [22 , 12]    The stock value is:         146.151
 At Node [22 , 13]    The stock value is:         213.603
 At Node [22 , 14]    The stock value is:         312.183
 At Node [22 , 15]    The stock value is:          456.26
 At Node [22 , 16]    The stock value is:         666.831
 At Node [22 , 17]    The stock value is:         974.583
 At Node [22 , 18]    The stock value is:        1424.368
 At Node [22 , 19]    The stock value is:        2081.735
 At Node [22 , 20]    The stock value is:        3042.485
 At Node [22 , 21]    The stock value is:        4446.637
 At Node [22 , 22]    The stock value is:        6498.825
 At Node [21 , 0 ]    The stock value is:            1.86
 At Node [21 , 1 ]    The stock value is:           2.719
 At Node [21 , 2 ]    The stock value is:           3.973
 At Node [21 , 3 ]    The stock value is:           5.807
 At Node [21 , 4 ]    The stock value is:           8.487
 At Node [21 , 5 ]    The stock value is:          12.405
 At Node [21 , 6 ]    The stock value is:          18.129
 At Node [21 , 7 ]    The stock value is:          26.497
 At Node [21 , 8 ]    The stock value is:          38.725
 At Node [21 , 9 ]    The stock value is:          56.597
 At Node [21 , 10]    The stock value is:          82.718
 At Node [21 , 11]    The stock value is:         120.893
 At Node [21 , 12]    The stock value is:         176.687
 At Node [21 , 13]    The stock value is:         258.231
 At Node [21 , 14]    The stock value is:         377.408
 At Node [21 , 15]    The stock value is:         551.587
 At Node [21 , 16]    The stock value is:         806.153
 At Node [21 , 17]    The stock value is:        1178.204
 At Node [21 , 18]    The stock value is:        1721.963
 At Node [21 , 19]    The stock value is:        2516.674
 At Node [21 , 20]    The stock value is:        3678.156
 At Node [21 , 21]    The stock value is:        5375.678
 At Node [20 , 0 ]    The stock value is:           2.249
 At Node [20 , 1 ]    The stock value is:           3.287
 At Node [20 , 2 ]    The stock value is:           4.804
 At Node [20 , 3 ]    The stock value is:           7.021
 At Node [20 , 4 ]    The stock value is:          10.261
 At Node [20 , 5 ]    The stock value is:          14.996
 At Node [20 , 6 ]    The stock value is:          21.917
 At Node [20 , 7 ]    The stock value is:          32.032
 At Node [20 , 8 ]    The stock value is:          46.816
 At Node [20 , 9 ]    The stock value is:          68.422
 At Node [20 , 10]    The stock value is:           100.0
 At Node [20 , 11]    The stock value is:         146.151
 At Node [20 , 12]    The stock value is:         213.603
 At Node [20 , 13]    The stock value is:         312.183
 At Node [20 , 14]    The stock value is:          456.26
 At Node [20 , 15]    The stock value is:         666.831
 At Node [20 , 16]    The stock value is:         974.583
 At Node [20 , 17]    The stock value is:        1424.368
 At Node [20 , 18]    The stock value is:        2081.735
 At Node [20 , 19]    The stock value is:        3042.485
 At Node [20 , 20]    The stock value is:        4446.637
 At Node [19 , 0 ]    The stock value is:           2.719
 At Node [19 , 1 ]    The stock value is:           3.973
 At Node [19 , 2 ]    The stock value is:           5.807
 At Node [19 , 3 ]    The stock value is:           8.487
 At Node [19 , 4 ]    The stock value is:          12.405
 At Node [19 , 5 ]    The stock value is:          18.129
 At Node [19 , 6 ]    The stock value is:          26.497
 At Node [19 , 7 ]    The stock value is:          38.725
 At Node [19 , 8 ]    The stock value is:          56.597
 At Node [19 , 9 ]    The stock value is:          82.718
 At Node [19 , 10]    The stock value is:         120.893
 At Node [19 , 11]    The stock value is:         176.687
 At Node [19 , 12]    The stock value is:         258.231
 At Node [19 , 13]    The stock value is:         377.408
 At Node [19 , 14]    The stock value is:         551.587
 At Node [19 , 15]    The stock value is:         806.153
 At Node [19 , 16]    The stock value is:        1178.204
 At Node [19 , 17]    The stock value is:        1721.963
 At Node [19 , 18]    The stock value is:        2516.674
 At Node [19 , 19]    The stock value is:        3678.156
 At Node [18 , 0 ]    The stock value is:           3.287
 At Node [18 , 1 ]    The stock value is:           4.804
 At Node [18 , 2 ]    The stock value is:           7.021
 At Node [18 , 3 ]    The stock value is:          10.261
 At Node [18 , 4 ]    The stock value is:          14.996
 At Node [18 , 5 ]    The stock value is:          21.917
 At Node [18 , 6 ]    The stock value is:          32.032
 At Node [18 , 7 ]    The stock value is:          46.816
 At Node [18 , 8 ]    The stock value is:          68.422
 At Node [18 , 9 ]    The stock value is:           100.0
 At Node [18 , 10]    The stock value is:         146.151
 At Node [18 , 11]    The stock value is:         213.603
 At Node [18 , 12]    The stock value is:         312.183
 At Node [18 , 13]    The stock value is:          456.26
 At Node [18 , 14]    The stock value is:         666.831
 At Node [18 , 15]    The stock value is:         974.583
 At Node [18 , 16]    The stock value is:        1424.368
 At Node [18 , 17]    The stock value is:        2081.735
 At Node [18 , 18]    The stock value is:        3042.485
 At Node [17 , 0 ]    The stock value is:           3.973
 At Node [17 , 1 ]    The stock value is:           5.807
 At Node [17 , 2 ]    The stock value is:           8.487
 At Node [17 , 3 ]    The stock value is:          12.405
 At Node [17 , 4 ]    The stock value is:          18.129
 At Node [17 , 5 ]    The stock value is:          26.497
 At Node [17 , 6 ]    The stock value is:          38.725
 At Node [17 , 7 ]    The stock value is:          56.597
 At Node [17 , 8 ]    The stock value is:          82.718
 At Node [17 , 9 ]    The stock value is:         120.893
 At Node [17 , 10]    The stock value is:         176.687
 At Node [17 , 11]    The stock value is:         258.231
 At Node [17 , 12]    The stock value is:         377.408
 At Node [17 , 13]    The stock value is:         551.587
 At Node [17 , 14]    The stock value is:         806.153
 At Node [17 , 15]    The stock value is:        1178.204
 At Node [17 , 16]    The stock value is:        1721.963
 At Node [17 , 17]    The stock value is:        2516.674
 At Node [16 , 0 ]    The stock value is:           4.804
 At Node [16 , 1 ]    The stock value is:           7.021
 At Node [16 , 2 ]    The stock value is:          10.261
 At Node [16 , 3 ]    The stock value is:          14.996
 At Node [16 , 4 ]    The stock value is:          21.917
 At Node [16 , 5 ]    The stock value is:          32.032
 At Node [16 , 6 ]    The stock value is:          46.816
 At Node [16 , 7 ]    The stock value is:          68.422
 At Node [16 , 8 ]    The stock value is:           100.0
 At Node [16 , 9 ]    The stock value is:         146.151
 At Node [16 , 10]    The stock value is:         213.603
 At Node [16 , 11]    The stock value is:         312.183
 At Node [16 , 12]    The stock value is:          456.26
 At Node [16 , 13]    The stock value is:         666.831
 At Node [16 , 14]    The stock value is:         974.583
 At Node [16 , 15]    The stock value is:        1424.368
 At Node [16 , 16]    The stock value is:        2081.735
 At Node [15 , 0 ]    The stock value is:           5.807
 At Node [15 , 1 ]    The stock value is:           8.487
 At Node [15 , 2 ]    The stock value is:          12.405
 At Node [15 , 3 ]    The stock value is:          18.129
 At Node [15 , 4 ]    The stock value is:          26.497
 At Node [15 , 5 ]    The stock value is:          38.725
 At Node [15 , 6 ]    The stock value is:          56.597
 At Node [15 , 7 ]    The stock value is:          82.718
 At Node [15 , 8 ]    The stock value is:         120.893
 At Node [15 , 9 ]    The stock value is:         176.687
 At Node [15 , 10]    The stock value is:         258.231
 At Node [15 , 11]    The stock value is:         377.408
 At Node [15 , 12]    The stock value is:         551.587
 At Node [15 , 13]    The stock value is:         806.153
 At Node [15 , 14]    The stock value is:        1178.204
 At Node [15 , 15]    The stock value is:        1721.963
 At Node [14 , 0 ]    The stock value is:           7.021
 At Node [14 , 1 ]    The stock value is:          10.261
 At Node [14 , 2 ]    The stock value is:          14.996
 At Node [14 , 3 ]    The stock value is:          21.917
 At Node [14 , 4 ]    The stock value is:          32.032
 At Node [14 , 5 ]    The stock value is:          46.816
 At Node [14 , 6 ]    The stock value is:          68.422
 At Node [14 , 7 ]    The stock value is:           100.0
 At Node [14 , 8 ]    The stock value is:         146.151
 At Node [14 , 9 ]    The stock value is:         213.603
 At Node [14 , 10]    The stock value is:         312.183
 At Node [14 , 11]    The stock value is:          456.26
 At Node [14 , 12]    The stock value is:         666.831
 At Node [14 , 13]    The stock value is:         974.583
 At Node [14 , 14]    The stock value is:        1424.368
 At Node [13 , 0 ]    The stock value is:           8.487
 At Node [13 , 1 ]    The stock value is:          12.405
 At Node [13 , 2 ]    The stock value is:          18.129
 At Node [13 , 3 ]    The stock value is:          26.497
 At Node [13 , 4 ]    The stock value is:          38.725
 At Node [13 , 5 ]    The stock value is:          56.597
 At Node [13 , 6 ]    The stock value is:          82.718
 At Node [13 , 7 ]    The stock value is:         120.893
 At Node [13 , 8 ]    The stock value is:         176.687
 At Node [13 , 9 ]    The stock value is:         258.231
 At Node [13 , 10]    The stock value is:         377.408
 At Node [13 , 11]    The stock value is:         551.587
 At Node [13 , 12]    The stock value is:         806.153
 At Node [13 , 13]    The stock value is:        1178.204
 At Node [12 , 0 ]    The stock value is:          10.261
 At Node [12 , 1 ]    The stock value is:          14.996
 At Node [12 , 2 ]    The stock value is:          21.917
 At Node [12 , 3 ]    The stock value is:          32.032
 At Node [12 , 4 ]    The stock value is:          46.816
 At Node [12 , 5 ]    The stock value is:          68.422
 At Node [12 , 6 ]    The stock value is:           100.0
 At Node [12 , 7 ]    The stock value is:         146.151
 At Node [12 , 8 ]    The stock value is:         213.603
 At Node [12 , 9 ]    The stock value is:         312.183
 At Node [12 , 10]    The stock value is:          456.26
 At Node [12 , 11]    The stock value is:         666.831
 At Node [12 , 12]    The stock value is:         974.583
 At Node [11 , 0 ]    The stock value is:          12.405
 At Node [11 , 1 ]    The stock value is:          18.129
 At Node [11 , 2 ]    The stock value is:          26.497
 At Node [11 , 3 ]    The stock value is:          38.725
 At Node [11 , 4 ]    The stock value is:          56.597
 At Node [11 , 5 ]    The stock value is:          82.718
 At Node [11 , 6 ]    The stock value is:         120.893
 At Node [11 , 7 ]    The stock value is:         176.687
 At Node [11 , 8 ]    The stock value is:         258.231
 At Node [11 , 9 ]    The stock value is:         377.408
 At Node [11 , 10]    The stock value is:         551.587
 At Node [11 , 11]    The stock value is:         806.153
 At Node [10 , 0 ]    The stock value is:          14.996
 At Node [10 , 1 ]    The stock value is:          21.917
 At Node [10 , 2 ]    The stock value is:          32.032
 At Node [10 , 3 ]    The stock value is:          46.816
 At Node [10 , 4 ]    The stock value is:          68.422
 At Node [10 , 5 ]    The stock value is:           100.0
 At Node [10 , 6 ]    The stock value is:         146.151
 At Node [10 , 7 ]    The stock value is:         213.603
 At Node [10 , 8 ]    The stock value is:         312.183
 At Node [10 , 9 ]    The stock value is:          456.26
 At Node [10 , 10]    The stock value is:         666.831
 At Node [9  , 0 ]    The stock value is:          18.129
 At Node [9  , 1 ]    The stock value is:          26.497
 At Node [9  , 2 ]    The stock value is:          38.725
 At Node [9  , 3 ]    The stock value is:          56.597
 At Node [9  , 4 ]    The stock value is:          82.718
 At Node [9  , 5 ]    The stock value is:         120.893
 At Node [9  , 6 ]    The stock value is:         176.687
 At Node [9  , 7 ]    The stock value is:         258.231
 At Node [9  , 8 ]    The stock value is:         377.408
 At Node [9  , 9 ]    The stock value is:         551.587
 At Node [8  , 0 ]    The stock value is:          21.917
 At Node [8  , 1 ]    The stock value is:          32.032
 At Node [8  , 2 ]    The stock value is:          46.816
 At Node [8  , 3 ]    The stock value is:          68.422
 At Node [8  , 4 ]    The stock value is:           100.0
 At Node [8  , 5 ]    The stock value is:         146.151
 At Node [8  , 6 ]    The stock value is:         213.603
 At Node [8  , 7 ]    The stock value is:         312.183
 At Node [8  , 8 ]    The stock value is:          456.26
 At Node [7  , 0 ]    The stock value is:          26.497
 At Node [7  , 1 ]    The stock value is:          38.725
 At Node [7  , 2 ]    The stock value is:          56.597
 At Node [7  , 3 ]    The stock value is:          82.718
 At Node [7  , 4 ]    The stock value is:         120.893
 At Node [7  , 5 ]    The stock value is:         176.687
 At Node [7  , 6 ]    The stock value is:         258.231
 At Node [7  , 7 ]    The stock value is:         377.408
 At Node [6  , 0 ]    The stock value is:          32.032
 At Node [6  , 1 ]    The stock value is:          46.816
 At Node [6  , 2 ]    The stock value is:          68.422
 At Node [6  , 3 ]    The stock value is:           100.0
 At Node [6  , 4 ]    The stock value is:         146.151
 At Node [6  , 5 ]    The stock value is:         213.603
 At Node [6  , 6 ]    The stock value is:         312.183
 At Node [5  , 0 ]    The stock value is:          38.725
 At Node [5  , 1 ]    The stock value is:          56.597
 At Node [5  , 2 ]    The stock value is:          82.718
 At Node [5  , 3 ]    The stock value is:         120.893
 At Node [5  , 4 ]    The stock value is:         176.687
 At Node [5  , 5 ]    The stock value is:         258.231
 At Node [4  , 0 ]    The stock value is:          46.816
 At Node [4  , 1 ]    The stock value is:          68.422
 At Node [4  , 2 ]    The stock value is:           100.0
 At Node [4  , 3 ]    The stock value is:         146.151
 At Node [4  , 4 ]    The stock value is:         213.603
 At Node [3  , 0 ]    The stock value is:          56.597
 At Node [3  , 1 ]    The stock value is:          82.718
 At Node [3  , 2 ]    The stock value is:         120.893
 At Node [3  , 3 ]    The stock value is:         176.687
 At Node [2  , 0 ]    The stock value is:          68.422
 At Node [2  , 1 ]    The stock value is:           100.0
 At Node [2  , 2 ]    The stock value is:         146.151
 At Node [1  , 0 ]    The stock value is:          82.718
 At Node [1  , 1 ]    The stock value is:         120.893
 At Node [0  , 0 ]    The stock value is:           100.0
In [15]:
# Option Value Path
for (i, j), value in O_vals_HW.items():
    print(f" At Node [{i:<3}, {j:<2}]    The option value is: {value:>15}")
 At Node [25 , 0 ]    The option value is:             0.0
 At Node [25 , 1 ]    The option value is:             0.0
 At Node [25 , 2 ]    The option value is:             0.0
 At Node [25 , 3 ]    The option value is:             0.0
 At Node [25 , 4 ]    The option value is:             0.0
 At Node [25 , 5 ]    The option value is:             0.0
 At Node [25 , 6 ]    The option value is:             0.0
 At Node [25 , 7 ]    The option value is:             0.0
 At Node [25 , 8 ]    The option value is:             0.0
 At Node [25 , 9 ]    The option value is:             0.0
 At Node [25 , 10]    The option value is:             0.0
 At Node [25 , 11]    The option value is:             0.0
 At Node [25 , 12]    The option value is:             0.0
 At Node [25 , 13]    The option value is:           5.893
 At Node [25 , 14]    The option value is:          61.687
 At Node [25 , 15]    The option value is:         143.231
 At Node [25 , 16]    The option value is:         262.408
 At Node [25 , 17]    The option value is:         436.587
 At Node [25 , 18]    The option value is:         691.153
 At Node [25 , 19]    The option value is:        1063.204
 At Node [25 , 20]    The option value is:        1606.963
 At Node [25 , 21]    The option value is:        2401.674
 At Node [25 , 22]    The option value is:        3563.156
 At Node [25 , 23]    The option value is:        5260.678
 At Node [25 , 24]    The option value is:        7741.632
 At Node [25 , 25]    The option value is:       11367.583
 At Node [24 , 0 ]    The option value is:             0.0
 At Node [24 , 1 ]    The option value is:             0.0
 At Node [24 , 2 ]    The option value is:             0.0
 At Node [24 , 3 ]    The option value is:             0.0
 At Node [24 , 4 ]    The option value is:             0.0
 At Node [24 , 5 ]    The option value is:             0.0
 At Node [24 , 6 ]    The option value is:             0.0
 At Node [24 , 7 ]    The option value is:             0.0
 At Node [24 , 8 ]    The option value is:             0.0
 At Node [24 , 9 ]    The option value is:             0.0
 At Node [24 , 10]    The option value is:             0.0
 At Node [24 , 11]    The option value is:             0.0
 At Node [24 , 12]    The option value is:           2.679
 At Node [24 , 13]    The option value is:          31.948
 At Node [24 , 14]    The option value is:          98.749
 At Node [24 , 15]    The option value is:         196.381
 At Node [24 , 16]    The option value is:          341.26
 At Node [24 , 17]    The option value is:         551.831
 At Node [24 , 18]    The option value is:         859.583
 At Node [24 , 19]    The option value is:        1309.368
 At Node [24 , 20]    The option value is:        1966.735
 At Node [24 , 21]    The option value is:        2927.485
 At Node [24 , 22]    The option value is:        4331.637
 At Node [24 , 23]    The option value is:        6383.825
 At Node [24 , 24]    The option value is:        9383.128
 At Node [23 , 0 ]    The option value is:             0.0
 At Node [23 , 1 ]    The option value is:             0.0
 At Node [23 , 2 ]    The option value is:             0.0
 At Node [23 , 3 ]    The option value is:             0.0
 At Node [23 , 4 ]    The option value is:             0.0
 At Node [23 , 5 ]    The option value is:             0.0
 At Node [23 , 6 ]    The option value is:             0.0
 At Node [23 , 7 ]    The option value is:             0.0
 At Node [23 , 8 ]    The option value is:             0.0
 At Node [23 , 9 ]    The option value is:             0.0
 At Node [23 , 10]    The option value is:             0.0
 At Node [23 , 11]    The option value is:           1.217
 At Node [23 , 12]    The option value is:          16.034
 At Node [23 , 13]    The option value is:           62.65
 At Node [23 , 14]    The option value is:         142.656
 At Node [23 , 15]    The option value is:         262.408
 At Node [23 , 16]    The option value is:         436.587
 At Node [23 , 17]    The option value is:         691.153
 At Node [23 , 18]    The option value is:        1063.204
 At Node [23 , 19]    The option value is:        1606.963
 At Node [23 , 20]    The option value is:        2401.674
 At Node [23 , 21]    The option value is:        3563.156
 At Node [23 , 22]    The option value is:        5260.678
 At Node [23 , 23]    The option value is:        7741.632
 At Node [22 , 0 ]    The option value is:             0.0
 At Node [22 , 1 ]    The option value is:             0.0
 At Node [22 , 2 ]    The option value is:             0.0
 At Node [22 , 3 ]    The option value is:             0.0
 At Node [22 , 4 ]    The option value is:             0.0
 At Node [22 , 5 ]    The option value is:             0.0
 At Node [22 , 6 ]    The option value is:             0.0
 At Node [22 , 7 ]    The option value is:             0.0
 At Node [22 , 8 ]    The option value is:             0.0
 At Node [22 , 9 ]    The option value is:             0.0
 At Node [22 , 10]    The option value is:           0.553
 At Node [22 , 11]    The option value is:            7.89
 At Node [22 , 12]    The option value is:          37.398
 At Node [22 , 13]    The option value is:          98.964
 At Node [22 , 14]    The option value is:         196.096
 At Node [22 , 15]    The option value is:          341.26
 At Node [22 , 16]    The option value is:         551.831
 At Node [22 , 17]    The option value is:         859.583
 At Node [22 , 18]    The option value is:        1309.368
 At Node [22 , 19]    The option value is:        1966.735
 At Node [22 , 20]    The option value is:        2927.485
 At Node [22 , 21]    The option value is:        4331.637
 At Node [22 , 22]    The option value is:        6383.825
 At Node [21 , 0 ]    The option value is:             0.0
 At Node [21 , 1 ]    The option value is:             0.0
 At Node [21 , 2 ]    The option value is:             0.0
 At Node [21 , 3 ]    The option value is:             0.0
 At Node [21 , 4 ]    The option value is:             0.0
 At Node [21 , 5 ]    The option value is:             0.0
 At Node [21 , 6 ]    The option value is:             0.0
 At Node [21 , 7 ]    The option value is:             0.0
 At Node [21 , 8 ]    The option value is:             0.0
 At Node [21 , 9 ]    The option value is:           0.252
 At Node [21 , 10]    The option value is:           3.859
 At Node [21 , 11]    The option value is:          21.087
 At Node [21 , 12]    The option value is:          65.442
 At Node [21 , 13]    The option value is:         142.633
 At Node [21 , 14]    The option value is:         262.408
 At Node [21 , 15]    The option value is:         436.587
 At Node [21 , 16]    The option value is:         691.153
 At Node [21 , 17]    The option value is:        1063.204
 At Node [21 , 18]    The option value is:        1606.963
 At Node [21 , 19]    The option value is:        2401.674
 At Node [21 , 20]    The option value is:        3563.156
 At Node [21 , 21]    The option value is:        5260.678
 At Node [20 , 0 ]    The option value is:             0.0
 At Node [20 , 1 ]    The option value is:             0.0
 At Node [20 , 2 ]    The option value is:             0.0
 At Node [20 , 3 ]    The option value is:             0.0
 At Node [20 , 4 ]    The option value is:             0.0
 At Node [20 , 5 ]    The option value is:             0.0
 At Node [20 , 6 ]    The option value is:             0.0
 At Node [20 , 7 ]    The option value is:             0.0
 At Node [20 , 8 ]    The option value is:           0.114
 At Node [20 , 9 ]    The option value is:           1.879
 At Node [20 , 10]    The option value is:          11.492
 At Node [20 , 11]    The option value is:          41.165
 At Node [20 , 12]    The option value is:         100.333
 At Node [20 , 13]    The option value is:         196.085
 At Node [20 , 14]    The option value is:          341.26
 At Node [20 , 15]    The option value is:         551.831
 At Node [20 , 16]    The option value is:         859.583
 At Node [20 , 17]    The option value is:        1309.368
 At Node [20 , 18]    The option value is:        1966.735
 At Node [20 , 19]    The option value is:        2927.485
 At Node [20 , 20]    The option value is:        4331.637
 At Node [19 , 0 ]    The option value is:             0.0
 At Node [19 , 1 ]    The option value is:             0.0
 At Node [19 , 2 ]    The option value is:             0.0
 At Node [19 , 3 ]    The option value is:             0.0
 At Node [19 , 4 ]    The option value is:             0.0
 At Node [19 , 5 ]    The option value is:             0.0
 At Node [19 , 6 ]    The option value is:             0.0
 At Node [19 , 7 ]    The option value is:           0.052
 At Node [19 , 8 ]    The option value is:            0.91
 At Node [19 , 9 ]    The option value is:           6.152
 At Node [19 , 10]    The option value is:           24.58
 At Node [19 , 11]    The option value is:          67.926
 At Node [19 , 12]    The option value is:         143.304
 At Node [19 , 13]    The option value is:         262.408
 At Node [19 , 14]    The option value is:         436.587
 At Node [19 , 15]    The option value is:         691.153
 At Node [19 , 16]    The option value is:        1063.204
 At Node [19 , 17]    The option value is:        1606.963
 At Node [19 , 18]    The option value is:        2401.674
 At Node [19 , 19]    The option value is:        3563.156
 At Node [18 , 0 ]    The option value is:             0.0
 At Node [18 , 1 ]    The option value is:             0.0
 At Node [18 , 2 ]    The option value is:             0.0
 At Node [18 , 3 ]    The option value is:             0.0
 At Node [18 , 4 ]    The option value is:             0.0
 At Node [18 , 5 ]    The option value is:             0.0
 At Node [18 , 6 ]    The option value is:           0.024
 At Node [18 , 7 ]    The option value is:           0.439
 At Node [18 , 8 ]    The option value is:           3.246
 At Node [18 , 9 ]    The option value is:          14.213
 At Node [18 , 10]    The option value is:          44.021
 At Node [18 , 11]    The option value is:         101.867
 At Node [18 , 12]    The option value is:         196.417
 At Node [18 , 13]    The option value is:          341.26
 At Node [18 , 14]    The option value is:         551.831
 At Node [18 , 15]    The option value is:         859.583
 At Node [18 , 16]    The option value is:        1309.368
 At Node [18 , 17]    The option value is:        1966.735
 At Node [18 , 18]    The option value is:        2927.485
 At Node [17 , 0 ]    The option value is:             0.0
 At Node [17 , 1 ]    The option value is:             0.0
 At Node [17 , 2 ]    The option value is:             0.0
 At Node [17 , 3 ]    The option value is:             0.0
 At Node [17 , 4 ]    The option value is:             0.0
 At Node [17 , 5 ]    The option value is:           0.011
 At Node [17 , 6 ]    The option value is:           0.211
 At Node [17 , 7 ]    The option value is:           1.693
 At Node [17 , 8 ]    The option value is:           8.065
 At Node [17 , 9 ]    The option value is:          27.223
 At Node [17 , 10]    The option value is:          70.035
 At Node [17 , 11]    The option value is:         144.213
 At Node [17 , 12]    The option value is:         262.408
 At Node [17 , 13]    The option value is:         436.587
 At Node [17 , 14]    The option value is:         691.153
 At Node [17 , 15]    The option value is:        1063.204
 At Node [17 , 16]    The option value is:        1606.963
 At Node [17 , 17]    The option value is:        2401.674
 At Node [16 , 0 ]    The option value is:             0.0
 At Node [16 , 1 ]    The option value is:             0.0
 At Node [16 , 2 ]    The option value is:             0.0
 At Node [16 , 3 ]    The option value is:             0.0
 At Node [16 , 4 ]    The option value is:           0.005
 At Node [16 , 5 ]    The option value is:           0.101
 At Node [16 , 6 ]    The option value is:           0.874
 At Node [16 , 7 ]    The option value is:           4.502
 At Node [16 , 8 ]    The option value is:           16.36
 At Node [16 , 9 ]    The option value is:          46.286
 At Node [16 , 10]    The option value is:         103.322
 At Node [16 , 11]    The option value is:         196.866
 At Node [16 , 12]    The option value is:          341.26
 At Node [16 , 13]    The option value is:         551.831
 At Node [16 , 14]    The option value is:         859.583
 At Node [16 , 15]    The option value is:        1309.368
 At Node [16 , 16]    The option value is:        1966.735
 At Node [15 , 0 ]    The option value is:             0.0
 At Node [15 , 1 ]    The option value is:             0.0
 At Node [15 , 2 ]    The option value is:             0.0
 At Node [15 , 3 ]    The option value is:           0.002
 At Node [15 , 4 ]    The option value is:           0.049
 At Node [15 , 5 ]    The option value is:           0.447
 At Node [15 , 6 ]    The option value is:           2.478
 At Node [15 , 7 ]    The option value is:           9.662
 At Node [15 , 8 ]    The option value is:          29.313
 At Node [15 , 9 ]    The option value is:          71.816
 At Node [15 , 10]    The option value is:         145.137
 At Node [15 , 11]    The option value is:         262.408
 At Node [15 , 12]    The option value is:         436.587
 At Node [15 , 13]    The option value is:         691.153
 At Node [15 , 14]    The option value is:        1063.204
 At Node [15 , 15]    The option value is:        1606.963
 At Node [14 , 0 ]    The option value is:             0.0
 At Node [14 , 1 ]    The option value is:             0.0
 At Node [14 , 2 ]    The option value is:           0.001
 At Node [14 , 3 ]    The option value is:           0.023
 At Node [14 , 4 ]    The option value is:           0.227
 At Node [14 , 5 ]    The option value is:           1.348
 At Node [14 , 6 ]    The option value is:           5.616
 At Node [14 , 7 ]    The option value is:          18.099
 At Node [14 , 8 ]    The option value is:          48.129
 At Node [14 , 9 ]    The option value is:         104.622
 At Node [14 , 10]    The option value is:         197.323
 At Node [14 , 11]    The option value is:          341.26
 At Node [14 , 12]    The option value is:         551.831
 At Node [14 , 13]    The option value is:         859.583
 At Node [14 , 14]    The option value is:        1309.368
 At Node [13 , 0 ]    The option value is:             0.0
 At Node [13 , 1 ]    The option value is:             0.0
 At Node [13 , 2 ]    The option value is:           0.011
 At Node [13 , 3 ]    The option value is:           0.115
 At Node [13 , 4 ]    The option value is:           0.725
 At Node [13 , 5 ]    The option value is:           3.219
 At Node [13 , 6 ]    The option value is:          11.003
 At Node [13 , 7 ]    The option value is:          31.011
 At Node [13 , 8 ]    The option value is:          73.318
 At Node [13 , 9 ]    The option value is:         145.987
 At Node [13 , 10]    The option value is:         262.408
 At Node [13 , 11]    The option value is:         436.587
 At Node [13 , 12]    The option value is:         691.153
 At Node [13 , 13]    The option value is:        1063.204
 At Node [12 , 0 ]    The option value is:             0.0
 At Node [12 , 1 ]    The option value is:           0.005
 At Node [12 , 2 ]    The option value is:           0.058
 At Node [12 , 3 ]    The option value is:           0.386
 At Node [12 , 4 ]    The option value is:           1.821
 At Node [12 , 5 ]    The option value is:           6.592
 At Node [12 , 6 ]    The option value is:          19.534
 At Node [12 , 7 ]    The option value is:           49.65
 At Node [12 , 8 ]    The option value is:         105.751
 At Node [12 , 9 ]    The option value is:         197.743
 At Node [12 , 10]    The option value is:          341.26
 At Node [12 , 11]    The option value is:         551.831
 At Node [12 , 12]    The option value is:         859.583
 At Node [11 , 0 ]    The option value is:           0.002
 At Node [11 , 1 ]    The option value is:           0.029
 At Node [11 , 2 ]    The option value is:           0.204
 At Node [11 , 3 ]    The option value is:           1.019
 At Node [11 , 4 ]    The option value is:           3.897
 At Node [11 , 5 ]    The option value is:          12.137
 At Node [11 , 6 ]    The option value is:          32.412
 At Node [11 , 7 ]    The option value is:          74.583
 At Node [11 , 8 ]    The option value is:         146.736
 At Node [11 , 9 ]    The option value is:         262.408
 At Node [11 , 10]    The option value is:         436.587
 At Node [11 , 11]    The option value is:         691.153
 At Node [10 , 0 ]    The option value is:           0.014
 At Node [10 , 1 ]    The option value is:           0.107
 At Node [10 , 2 ]    The option value is:           0.564
 At Node [10 , 3 ]    The option value is:           2.275
 At Node [10 , 4 ]    The option value is:           7.443
 At Node [10 , 5 ]    The option value is:          20.731
 At Node [10 , 6 ]    The option value is:          50.918
 At Node [10 , 7 ]    The option value is:         106.717
 At Node [10 , 8 ]    The option value is:         198.113
 At Node [10 , 9 ]    The option value is:          341.26
 At Node [10 , 10]    The option value is:         551.831
 At Node [9  , 0 ]    The option value is:           0.056
 At Node [9  , 1 ]    The option value is:           0.309
 At Node [9  , 2 ]    The option value is:           1.313
 At Node [9  , 3 ]    The option value is:           4.507
 At Node [9  , 4 ]    The option value is:          13.102
 At Node [9  , 5 ]    The option value is:           33.58
 At Node [9  , 6 ]    The option value is:          75.649
 At Node [9  , 7 ]    The option value is:         147.382
 At Node [9  , 8 ]    The option value is:         262.408
 At Node [9  , 9 ]    The option value is:         436.587
 At Node [8  , 0 ]    The option value is:           0.168
 At Node [8  , 1 ]    The option value is:           0.749
 At Node [8  , 2 ]    The option value is:           2.698
 At Node [8  , 3 ]    The option value is:           8.183
 At Node [8  , 4 ]    The option value is:          21.739
 At Node [8  , 5 ]    The option value is:           51.98
 At Node [8  , 6 ]    The option value is:         107.537
 At Node [8  , 7 ]    The option value is:         198.432
 At Node [8  , 8 ]    The option value is:          341.26
 At Node [7  , 0 ]    The option value is:           0.424
 At Node [7  , 1 ]    The option value is:           1.597
 At Node [7  , 2 ]    The option value is:           5.053
 At Node [7  , 3 ]    The option value is:          13.926
 At Node [7  , 4 ]    The option value is:           34.56
 At Node [7  , 5 ]    The option value is:          76.546
 At Node [7  , 6 ]    The option value is:         147.932
 At Node [7  , 7 ]    The option value is:         262.408
 At Node [6  , 0 ]    The option value is:           0.935
 At Node [6  , 1 ]    The option value is:           3.086
 At Node [6  , 2 ]    The option value is:           8.827
 At Node [6  , 3 ]    The option value is:          22.592
 At Node [6  , 4 ]    The option value is:          52.872
 At Node [6  , 5 ]    The option value is:         108.231
 At Node [6  , 6 ]    The option value is:         198.705
 At Node [5  , 0 ]    The option value is:           1.903
 At Node [5  , 1 ]    The option value is:           5.652
 At Node [5  , 2 ]    The option value is:          14.934
 At Node [5  , 3 ]    The option value is:          35.926
 At Node [5  , 4 ]    The option value is:          76.885
 At Node [5  , 5 ]    The option value is:         146.787
 At Node [4  , 0 ]    The option value is:           3.582
 At Node [4  , 1 ]    The option value is:            9.78
 At Node [4  , 2 ]    The option value is:          24.202
 At Node [4  , 3 ]    The option value is:          53.794
 At Node [4  , 4 ]    The option value is:         106.887
 At Node [3  , 0 ]    The option value is:           6.344
 At Node [3  , 1 ]    The option value is:          16.162
 At Node [3  , 2 ]    The option value is:          37.166
 At Node [3  , 3 ]    The option value is:          76.727
 At Node [2  , 0 ]    The option value is:          10.698
 At Node [2  , 1 ]    The option value is:          25.396
 At Node [2  , 2 ]    The option value is:          54.346
 At Node [1  , 0 ]    The option value is:          17.179
 At Node [1  , 1 ]    The option value is:          38.024
 At Node [0  , 0 ]    The option value is:          26.307

8.5. Final Model Output: Model Performance

It is important to determine how efficient the model is, specifically whether and with what speed it converges on a particular value. This will ensure we avoid using too many or too few time steps when running the model, resulting, respectively, in excessive computatational expense or inaccurate output.

We can see that our model converges fairly quickly. It only takes around 1000 steps for the model price to be accurate within rounding error.

In [16]:
def HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M):
    
    
    #Solved Parameters
    
    dt = T / Nsteps
    u = exp(sigma * sqrt(dt))
    d = 1. / u
    a = exp(r*dt) * exp(-div*dt)
    p = (a - d) / (u - d)
    
    #vector of payoff and option price in the tree
    S = np.zeros([Nsteps + 1, Nsteps + 1])
    f = np.zeros([Nsteps + 1, Nsteps + 1])
    
    # compute the S value at time t
    for i in range(0,Nsteps+1):
        for j in range(0,i+1):
            S[i,j] = S0 * u ** (j) * d ** (i - j)

    for j in range(0,Nsteps+1):
        f[Nsteps , j] = max(S[Nsteps, j] - K, 0)
    
    #  the backward recursion
    for i in range(Nsteps-1,-1,-1):
        for j in range(0,i+1):
            if i*dt > Tvest and S[i,j]>= M * K:
                f[i, j]= max(S[i, j] - K,0)
            elif i*dt > Tvest and S[i,j]< M * K:
                f[i, j]=(ee2*dt)*(max(S[i, j] - K, 0))+(1-ee2*dt)*exp(-r*dt)*(p*f[i + 1, j + 1] + (1 - p) * f[i + 1, j])      
            else:
                f[i, j] = (1-ee1*dt)*exp(-r * dt) * (p * f[i + 1, j + 1] + (1 - p) * f[i + 1, j])
    
    return f[0, 0]

#Inputs
    
S0 = 100
K = 115
T = 10
r = 0.05
div = 0.025
sigma = 0.30
    
Tvest=2 #vesting time
ee1 = 3/100 #forfeiture rate pre-vest
ee2 = 8/100 #forfeiture rate post-vest
M = 3


list_val = []
list_step = []

for Nsteps in range(10,1500, 100):
    list_val.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
    
for Nsteps in range(10,1500, 100):
    list_step.append(Nsteps)
    
# Visualize the simulated portfolio for risk and return

import matplotlib.pyplot as plt


with plt.style.context('seaborn'):
    fig = plt.figure(figsize=(14,8))
    ax = plt.axes()
    
    ax.set_title('Convergence of the Final Model',fontsize= 20)
    
    ax.plot(list_step, list_val)
    
    ax.set_xlabel('Number of Time Steps', fontsize= 15)
    ax.set_ylabel('Option Value', fontsize= 15)
    ax.grid(True)

8.6. Final Model Output: Sensitivity Analysis and Cost Evaluation

The Sponsoring Compnay will rationally seek to find an equilibrium between employee incentivization and the expense of granting the option.The Sponsor should thus undertake sensitivity analysis to evaluate the variablity of cost due to changes in company-determined variables (Strike, Time to Expiry, Time to vest), employee-determined variables(pre and post-vesting forfeiture rates, exercise multiple) and market-determined variables (risk-free rate, volatility, dividend yield). The following code produces which assist with the tasks of single-factor and dual-factor sensitivity analysis.

8.6.1. Final Model Output: Single-Factor Sensitivity Analysis

In [17]:
# Single Factor Sensitivity Analysis (1)
    
S0 = 100
K = 115
T = 10
r = 0.05
div = 0.025
sigma = 0.30
Nsteps = 40
    
Tvest=2 
ee1 = 3/100 #forfeiture rate
ee2 = 8/100 #forfeiture rate
M = 3



list_val1 = []
list_fac1 = []

for K in range(90, 116, 1):
    list_fac1.append(K)
    list_val1.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
In [18]:
# Single Factor Sensitivity Analysis (2)
    
S0 = S0
K = K
T = T
r = r
div = div
sigma = sigma
Nsteps = Nsteps
    
Tvest= Tvest
ee1 = ee1
ee2 = ee2
M = M

S0 = 100
K = 115
T = 10
r = 0.05
div = 0.025
sigma = 0.30
    
Tvest=2 #vesting time
ee1 = 3/100 #forfeiture rate pre-vest
ee2 = 8/100 #forfeiture rate post-vest
M = 3

list_val2 = []
list_fac2 = []

for T in range(5, 16, 1):
    list_fac2.append(T)
    list_val2.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
In [19]:
# Single Factor Sensitivity Analysis (3)
    
S0 = S0
K = K
T = T
r = r
div = div
sigma = sigma
Nsteps = Nsteps
    
Tvest= Tvest
ee1 = ee1
ee2 = ee2
M = M


list_val3 = []
list_fac3 = []

for Tvest in range(2, 8, 1):
    list_fac3.append(Tvest)
    list_val3.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
In [20]:
# Single Factor Sensitivity Analysis (4)
    
S0 = S0
K = K
T = T
r = r
div = div
sigma = sigma
Nsteps = Nsteps
    
Tvest= Tvest
ee1 = ee1
ee2 = ee2
M = M


list_val4 = []
list_fac4 = []

for ee1 in np.linspace(0.005, 0.08, 50):
    list_fac4.append(ee1)
    list_val4.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
In [21]:
# Single Factor Sensitivity Analysis (5)
    
S0 = S0
K = K
T = T
r = r
div = div
sigma = sigma
Nsteps = Nsteps
    
Tvest= Tvest
ee1 = ee1
ee2 = ee2
M = M

    
list_val5 = []
list_fac5 = []

for ee2 in np.linspace(0.005, 0.08, 50):
    list_fac5.append(ee2)
    list_val5.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
In [22]:
# Single Factor Sensitivity Analysis (6)
    
S0 = S0
K = K
T = T
r = r
div = div
sigma = sigma
Nsteps = Nsteps
    
Tvest= Tvest
ee1 = ee1
ee2 = ee2
M = M



list_val6 = []
list_fac6 = []

for M in np.linspace(1.0, 3.5, 15):
    list_fac6.append(M)
    list_val6.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
In [23]:
# Display results

'bmh', 'classic', 'dark_background', 'fast', 'fivethirtyeight', 'ggplot'
with plt.style.context('seaborn'):
    
    fig, ax = plt.subplots(3,2, figsize=(20,30))
    
    fig.suptitle('Single Factor Sensitivity Analysis', fontsize=26)

    ax[0,0].plot(list_fac1, list_val1)
    ax[0,1].plot(list_fac2, list_val2)
    ax[1,0].plot(list_fac3, list_val3)
    ax[1,1].plot(list_fac4, list_val4)
    ax[2,0].plot(list_fac5, list_val5)
    ax[2,1].plot(list_fac6, list_val6)
    
    # Set axis title
    ax[0,0].set_title('OPT. PRICE SENSITIVITY TO STRIKE',fontsize= 20), 
    ax[0,1].set_title('OPT. PRICE SENSITIVITY TO TIME TO EXPIRY',fontsize= 20), 
    ax[1,0].set_title('OPT. PRICE SENSITIVITY TO TIME TO VEST',fontsize= 20), 
    ax[1,1].set_title('OPT. PRICE SENSITIVITY TO PRE-VEST FORFEITURE',fontsize= 20),
    ax[2,0].set_title('OPT. PRICE SENSITIVITY TO POST-VEST FORFEITURE',fontsize= 20), 
    ax[2,1].set_title('OPT. PRICE SENSITIVITY TO EXERCISE MULTIPLE',fontsize= 20)
    
    
    # Set axis label
    ax[0,0].set_xlabel('STRIKE'), 
    ax[0,1].set_xlabel('TIME TO EXPIRY'), 
    ax[1,0].set_xlabel('TIME TO VEST'), 
    ax[1,1].set_xlabel('PRE-VEST FORFEITURE'),
    ax[2,0].set_xlabel('POST-VEST FORFEITURE'), 
    ax[2,1].set_xlabel('EXERCISE MULTIPLE')
    
      # Set axis label
    ax[0,0].set_ylabel('OPTION PRICE'), 
    ax[0,1].set_ylabel('OPTION PRICE'), 
    ax[1,0].set_ylabel('TIME TO VEST'), 
    ax[1,1].set_ylabel('OPTION PRICE'),
    ax[2,0].set_ylabel('OPTION PRICE'), 
    ax[2,1].set_ylabel('OPTION PRICE')



plt.show()

8.6.2. Final Model Output: Dual-Factor Sensitivity Analysis


Obviously there are innumerable possible permutations of dual-factor sensitivity analysis. The one below depicts option value sensitivity to Strike Price and Time to Expiry.

In [24]:
def f(K,T):
    
    S0 = 100
    K = 100
    T = 10
    r = 6 / 100
    div = 2.5/100
    sigma = 20 / 100
    Nsteps = 40
    
    Tvest=2 #vesting time
    ee1 = 3/100 #forfeiture rate
    ee2 = 8/100 #forfeiture rate
    M = 3
    
    list_valx = []
    list_valy = []
    list_valz = []
    
    for K in np.linspace(90, 116, 100):
        for T in np.linspace(5, 16, 100):
            list_valx.append(K)
            arr_x = np.array(list_valx)
            list_valy.append(T)
            arr_y = np.array(list_valy)
            list_valz.append(HW_binomial_call_test(S0, K, T, r, div, sigma, Nsteps, Tvest, ee1,ee2, M))
            arr_z = np.array(list_valz)
    return arr_z, arr_y, arr_x
In [25]:
result_SA = f(K,T)
In [26]:
from mpl_toolkits import mplot3d
%matplotlib notebook
import matplotlib.pyplot as plt


# Create the figure
fig = plt.figure(figsize=(10,8))
ax = plt.axes(projection='3d')

fig.suptitle('Dual Factor Sensitivity Analysis', fontsize=16)


# Generate the values
x_vals = result_SA[2]
y_vals = result_SA[1]
z_vals = result_SA[0]

# Plot the values
t=ax.scatter(x_vals, y_vals, z_vals, c=z_vals , cmap='viridis',  alpha=0.22);

ax.set_title('Sensitivity of Option Price to Strike AND Time to Expiry',fontsize= 12)

ax.set_xlabel('Strike')
ax.set_ylabel('Time To Expiry')
ax.set_zlabel('Option Price')

fig.colorbar(t)
Out[26]:
<matplotlib.colorbar.Colorbar at 0x1272a0af0b8>