# CS计算机代考程序代写 c++ Mathematical Institute University of Oxford

Mathematical Institute University of Oxford
Review Exam Financial Computing with C++ Hilary Term, 2021
􏰀 Your grade will be based on the best 3 solutions.
􏰀 Implement every function in a separate *.cpp file. Thus, you will submit 4 *.cpp files and output text file ReviewExam.txt. You have to submit the output file to avoid a failing grade.
􏰀 While implementing the functions below, you need to account for the singularities of the type 0/0.
􏰀 The issue time for all options coincides with the initial time. The maturities, barrier, and exercise times are strictly greater than the initial time.
Interpolation of data curves
Discount curve obtained from LIBOR rates by log linear interpolation
Input:
(∆i)i=1,…,M : the strictly increasing vector of periods for the market LI- BOR rates. The periods are given as year fractions. For example, ∆i = 0.25 corresponds to the three month LIBOR.
(Li)i=1,…,M : the market LIBOR rates.
t0 : the initial time given as year fraction.
Output: discount curve D = (D(t)) on [t0, t0 + ∆M ]. It is obtained by the following procedure:
1. We compute discount factors di for maturities ti = t0 + ∆i, i = 1,…,M.
2. We apply the log linear interpolation to (ti,di), i = 0,1,…,M, where d0 = 1.
1

Least-squares fitting of data curves
Discount curve by least-squares fit of swap rates Input:
(Ri)i=1,…,M : the vector of swap rates, where Ri is the market swap rate in the contract with time interval δt and number of payments i.
δt : the time interval between payments given as year fraction. t0 : the initial time given as year fraction.
L : a least-squares fitting method.
Output:
d = d(t) : the fitted discount curve.
ε = ε(t) : the error function of the fit for the discount curve.
The discount curve is given by
d(t) = exp(−γ(t)(t − t0)), t ≥ t0,
where yield curve γ = γ(t) is obtained in two steps: 1. We compute market yields γi for maturities
ti=t0+iδt, i=1,…,M, from the market swap rates.
2. We fit (γi, ti)i=1,…,M with method L. Options on a single stock
Clique option T: maturity
(ti)1≤i≤N : averaging times, tN < T. K : strike. 2 The payoff of the option at maturity is given by 1 􏰁N V(T)= N where S(t) is the spot price at t. Options on interest rates Up-and-out floor Underlying floor : N : notional R : floor rate δt : interval of time between the payments given as year fraction. m : total number of payments U : upper bound for the float (LIBOR) rate. Assume that today is the issue time of the interest rate floor. Denote this time by t0. The payment times of the floor are given by ti =t0 +iδt, 1≤i≤m. The up-and-out floor generates the same cash flow as the interest rate floor up to (and including) the payment time, when the float rate is greater then the barrier. After that time the floor is terminated. In other words, if we denote by τ the first payment time ti when the float rate L(ti, ti + δt) between ti and ti + δt is greater then U then, for a payment time tj, we have 1. if tj ≤ τ, then the owner of the up-and-out floor receives the same payment as in the case of standard interest rate floor: N max(Rδt − L(tj−1, tj )δt, 0) 2. if tj > τ, then the payment equals 0.
3
max(S(ti)−K,0),
i=1