University of Connecticut, School of Business
Financial Modeling with C#
FNCE5353
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).
1
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)
2δS0
(
use δS0 =
S0
1000
)
(2.1)
Γ =
V (S0 + δS0) + V (S0 − δS0)− 2V (S0)
(δS0)2
(
use δS0 =
S0
1000
)
(2.2)
Vega =
V (σ + δσ)− V (σ − δσ)
2δσ
(
use δσ =
σ
1000
)
(2.3)
Rho =
V (r + δr)− V (r − δr)
2δr
(
use δr =
r
1000
)
(2.4)
Θ =
V (t0 + δt0)− V (t0)
δt0
(
use δt0 =
T − t0
100n
)
(2.5)
• 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.
2
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.
3
学霸联盟