// Class STFutOption public static void Example2() { // Option data for opt1 and opt2 double CoP = -1; double underlying = 99.23; double strike = 99.25; double daysToExpiry = 82; double yieldVol = 0.449; // (_priceVol * _underlying) / (100 - _underlying); // option data only for double daysPerYear = 360; STFutOption myOpt1 = new STFutOption(CoP, underlying, strike, daysToExpiry, yieldVol); STFutOption myOpt2 = new STFutOption(CoP, underlying, strike, daysToExpiry, yieldVol, daysPerYear); // Showing Data Console.WriteLine("CoP = {0}; underlying = {1}; strike = {2}; daysToExpiry = {3}; yieldVol = {4}", CoP, underlying, strike, daysToExpiry, yieldVol); Console.WriteLine("daysPerYear Opt1 = {0} daysPerYear Opt2 = {1}", 365, daysPerYear); Console.WriteLine("CoP\t opt1: {0}\t opt2: {1}", myOpt1.COP, myOpt2.COP); Console.WriteLine("Price\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Price() / 100, myOpt2.Price() / 100); Console.WriteLine("Delta\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Delta(), myOpt2.Delta()); Console.WriteLine("Gamma\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Gamma(), myOpt2.Gamma()); Console.WriteLine("Theta\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Theta(), myOpt2.Theta()); Console.WriteLine("Vega \t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Vega(), myOpt2.Vega()); // Changing data:now opt2 become a call, underlying and expiry change myOpt2.SwitchCallPut(); // now is a call underlying = 99.05; // new price daysToExpiry--; // a day pass // updating options myOpt1.new_DaysToExpiry = daysToExpiry; myOpt2.new_DaysToExpiry = daysToExpiry; myOpt1.new_S = underlying; myOpt2.new_S = underlying; // showing new data Console.WriteLine("underlying = {0}; daysToExpiry = {1}", underlying, daysToExpiry); Console.WriteLine("CoP\t opt1: {0}\t opt2: {1}", myOpt1.COP, myOpt2.COP); Console.WriteLine("Price\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Price() / 100, myOpt2.Price() / 100); Console.WriteLine("Delta\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Delta(), myOpt2.Delta()); Console.WriteLine("Gamma\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Gamma(), myOpt2.Gamma()); Console.WriteLine("Theta\t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Theta(), myOpt2.Theta()); Console.WriteLine("Vega \t opt1: {0:F4}\t opt2: {1:F4}", myOpt1.Vega(), myOpt2.Vega()); }