https://stackoverflow.com/questions/6264249/how-does-the-compilation-linking-process-work https://www.youtube.com/watch?v=JsIJBh2OKhM
g++ ./include/binomial.h main.cpp binomial.cpp
- s1u = s0 * u; s1d = s0 * d
- c1u = max(0, s1u - x) || p1u = max(0, x - s1u) // X = Strike Price
- Portfolio of shares and an option -> v = h * S - c
- A portfolio, such that its value remains same in case of a upmove or a down move i.e. v1u = v1d
- Hence, equating v1u = v1d, we derive value of h -> hedge ratio. (Number of shares to but for writing each call)
- Calculate v1, calc p.v. of v1 tp get v0
- Again v0 = h * s0 - c0; from this, derive c0 & hence the value of call option
- Similarly get the value of put option
g++ ./include/binomial.h main.cpp binomial.cpp
- step 1 and step 2 -> same as above
- Risk netral probability of upmove = (1 + Rf - d) / (u - d).
- Expected future payoff = probability-weighted value of upmove and downmove
- Present value of xpected future payoff -> Required value of call / put
gives exact same results as version 1 Version 1 & 2 donot have multilevels and does not account number of days to expiry - We discount it by one year. Hence, it gives us value of an option that expires one year from now while calculating only one branch / level (i.e. not multi-level)
g++ ./include/binomial2.h main.cpp binomial2.cpp
Version 3,4,5 are in binomial2. They take into consideration the days to expiration while having equal number of branches as to number of days & daily compunding / discounting.