FinMath.MC (Double, Double, Double, Double, Double, EPutCall, Int32) Method
Parameters
- S
- double
spot price of underlying asset
- X
- double
option exercise (strike) price
- t
- double
time till exercise (fraction of year, f.ex. 0.5 for six months)
- s
- double
standard deviation of underlying asset (log) returns (annual, decimal, f.ex. 0.2 for 20%)
- r
- double
risk-free interst rate (continuous, decimal, f.ex. 0.1 for 10%)
- PutCall
- EPutCall
EPutCall.Call
EPutCall.Put
- n
- int
number of price trajectories (default = 100000)
Return Value
doubledouble S = 35.0; // spot price double X = 35.0; // strike price double t = 1.0; // time to expiration (one year) double s = 0.2; // volatility (annualized standard deviation of asset log returns) (20%) double r = 0.1; // risk-free interest rate (10%) double P = TFinMath.BS(S,X,t,s,r, EOptionType.kCall); double BSV = TFinMath.ImpliedVolatility(S,X,t,r,P,EOptionType.kCall,EOptionPrice.kBlackScholes); double BMV = TFinMath.ImpliedVolatility(S,X,t,r,P,EOptionType.kCall,EOptionPrice.kBinomial); double MCV = TFinMath.ImpliedVolatility(S,X,t,r,P,EOptionType.kCall,EOptionPrice.kMonteCarlo); Console.WriteLine(); Console.WriteLine("Spot price = {0:F2}", S); Console.WriteLine("Strike price = {0:F2}", X); Console.WriteLine("Time to expiration = {0:F2}", t); Console.WriteLine("Volatility = {0:F2}", s); Console.WriteLine("Interest rate = {0:F2}", r); Console.WriteLine(); Console.WriteLine("Implied BS = {0:F2}", BSV); Console.WriteLine("Implied BM = {0:F2}", BMV); Console.WriteLine("Implied MC = {0:F2}", MCV); Console.WriteLine(); Console.WriteLine("Black-Scholes = {0:F2}", P); Console.WriteLine("Binomial = {0:F2}", TFinMath.BM(S,X,t,s,r,EOptionType.kCall,100)); Console.WriteLine("Monte Carlo = {0:F2}", TFinMath.MC(S,X,t,s,r,EOptionType.kCall)); Console.WriteLine(); Console.WriteLine("Delta = {0:F2}", TFinMath.Delta(S,X,t,s,r,EOptionType.kCall)); Console.WriteLine("Gamma = {0:F2}", TFinMath.Gamma(S,X,t,s,r)); Console.WriteLine("Theta = {0:F2}", TFinMath.Theta(S,X,t,s,r,EOptionType.kCall)); Console.WriteLine("Vega = {0:F2}", TFinMath.Vega (S,X,t,s,r)); Console.WriteLine("Rho = {0:F2}", TFinMath.Rho (S,X,t,s,r,EOptionType.kCall));