University of Connecticut, School of Business
Financial Modeling with C#
Spring 2020
Instructor: Dr. Sateesh Mane
Contact email: UCONNCSMane@gmail.com
c© Sateesh R. Mane 2020
1 Project 3
• Please upload your solution to HuskyCT.
• Please submit your solution as a C# file, with your name and PeopleSoft ID and "FNCE5353"
and "Project3" to identify yourself and the course.
(first name)_(last name)_(PeopleSoft ID)_FNCE5353_Project3.cs
• Note:
1. Students in a team work together for this project.
2. It is acceptable if all members in a team upload the same program code.
3. However, every student must upload a solution for this project.
• You may submit multiple updates until the deadline. Only your last submission is graded.
• Note: submitted files which do not compile will score automatic zero (or F).
2 BinomialOption class
• This project is to write BinomialOption class, which supports methods to calculate the Fair
Value and Greeks and implied volatility for American or European put and call options.
• Declare a class BinomialOption.
1. Write suitable (private) data members for the data of an option, including whether the
option is American or European and whether the option is put or call.
2. Denote the variables by the following notation: strike = K, expiration time = T , risk-free
interest rate = r, continuous dividend yield = q, volatility = σ.
3. The data are read only, so write getters but not setters for the data members.
4. Write a public class constructor to initialize the values of the data members.
5. Write a public method “void print()” to print the object’s data to the console.
• Write class methods to calculate and return the values of the following quantities of an option.
1. Fair Value, Delta, Gamma, Vega, Rho, Theta
2. The input parameters are the current stock price S0, the current time t0 and the number
of time steps n.
3. If you wish, you can write only one method “Valuation” which returns all of the values
as references (or use the “out” keyword).
4. To calculate the Greeks (partial derivatives), employ finite differences.
∆ =
V (S0 + δS0)− V (S0 − δS0)
use δS0 =
Γ =
V (S0 + δS0) + V (S0 − δS0)− 2V (S0)
use δS0 =
Vega =
V (σ + δσ)− V (σ − δσ)
use δσ =
Rho =
V (r + δr)− V (r − δr)
use δr =
Θ =
V (t0 + δt0)− V (t0)
use δt0 =
T − t0
• Write a class method “impliedVolatility” to calculate and return the implied volatility
(measured in percent).
1. The input parameters are the current stock price S0, the current time t0, the target
option value Vtarget, the tolerance Vtol and the number of time steps n.
2. Use the Newton-Raphson algorithm (use Vega for the derivative).
3. Iterate until the fair value V satisfies the condition |V − Vtarget| ≤ Vtol.
4. You may use the “out” keyword if you wish.
3 Main function
• Write a main function in a “Main” class.
• Do not write the main function in the BSMOption class.
• Instantiate some options with suitable inputs (both puts and calls).
• Invoke your class methods and demonstrate that put-call parity is satisfied in all cases.
• Also calculate the implied volatility.